[mapserver-users] not unique image filenames problem
Matt Carlson
matt at aruke.com
Mon Apr 1 02:00:30 PST 2002
i set the mime type to img/(image type) and wrote the image right on to the
response
print "Content-type: image/$ctext\r\n\r\n";
open(FILE,$mapfile);
binmode(FILE);
@buffer = <FILE>;
foreach (@buffer){
print $_;
}
close(FILE);
system("rm -f $mapfile");
i call this perl script right from the img src attribute.
also for my variable mapfile i used a exclusively locked file counter as
well as an application url token.. in case the filename was being generated
at the same exact second.
we did some serious stress testing and this is what worked best. hope it
helps!
matt
----- Original Message -----
From: "Stepan Kafka" <stepan.kafka at centrum.cz>
To: <schut at GisSrv.IenD.wau.nl>; <mapserver-users at lists.gis.umn.edu>
Sent: Thursday, March 28, 2002 8:42 PM
Subject: RE: [mapserver-users] not unique image filenames problem
> I have had the same experience on some server. I solved it by using
>
> saveImage (where I generate the imagename from time) instead of
> saveWebImage. Eg.:
>
> $imgname = $your_session_specific_string.time()."png";
> $img->saveImage($your_image_path.$imgname, MS_PNG, 0, 1, 0);
>
> then you can access the image via:
> $url = $map->web->imageurl.$imgname;
>
> Stepan Kafka
>
> > -----Původní zpráva-----
> > Od: owner-mapserver-users at lists.gis.umn.edu
> > [mailto:owner-mapserver-users at lists.gis.umn.edu]za uživatele Vincent
> > Schut
> > Odesláno: 28. března 2002 11:20
> > Komu: mapserver-users at lists.gis.umn.edu
> > Předmět: [mapserver-users] not unique image filenames problem
> >
> >
> > Hi folks,
> >
> > I'm running into a strange problem. Propably I'm doing something wrong
:-)
> >
> > I'm using php/mapscript to create (quite simple) raster images
> > and view them
> > in a web page where you can zoom in/out and pan etc.
> > Everything works well, except that sometimes not the desired image of
the
> > next zoom (or pan) operation appears, but an image that was created some
> > steps ago. I found out that this happens because the
> > $map->saveWebImage does
> > *not* always create a new, unique name for the image to be saved
> > in the temp
> > directory. If an image with the same name already exists, the
> > save apparently
> > doesn't succeed and the old image is loaded.
> >
> > Something wrong with the way mapserver creates "unique" image file
names?
> > How to solve this? Anybody had the same experience?
> >
> > Curiously,
> >
> > Vincent Schut.
> >
> >
>
>
More information about the MapServer-users
mailing list