[PHP] Outputting multiple images
I've found a little problem that's not explicitly a php problem but I was hoping that php may be the solution. Someone is shown an image and then asked if they wish to change that image. If they answer yes they are taken to an upload form and the new image is upload to the server overwitting the old image using the same filename. They are then taken to a page to show them the image they just uploaded but the old image is diplayed from cache instead of the new photo being shown. I'm using absolute path to the image on the server, not URL. Is there a way to get the script to load in the new photos? Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting multiple images
I've found a little problem that's not explicitly a php problem but I was hoping that php may be the solution. Someone is shown an image and then asked if they wish to change that image. If they answer yes they are taken to an upload form and the new image is upload to the server overwitting the old image using the same filename. They are then taken to a page to show them the image they just uploaded but the old image is diplayed from cache instead of the new photo being shown. I'm using absolute path to the image on the server, not URL. Is there a way to get the script to load in the new photos? I'm sure there are some no-cache header()s you can send. Take a look on the header() manual page, I think there are some examples there. www.php.net/header ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting multiple images
On Thursday, Nov 7, 2002, at 14:49 Europe/London, [EMAIL PROTECTED] wrote: I've found a little problem that's not explicitly a php problem but I was hoping that php may be the solution. Someone is shown an image and then asked if they wish to change that image. If they answer yes they are taken to an upload form and the new image is upload to the server overwitting the old image using the same filename. They are then taken to a page to show them the image they just uploaded but the old image is diplayed from cache instead of the new photo being shown. I'm using absolute path to the image on the server, not URL. Is there a way to get the script to load in the new photos? When you create the src tag in for the image, add a random number query string - that will cause the browser to request the image instead of using the cached version. I.e... echo 'img src=/images/image.jpg?'.rand(1000,).''; -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting multiple images
Maybe use the random functions to generate a random file name which wouldn't be cached, I.E.: c83jsdbd732jd.png or whatever. Adam Voigt [EMAIL PROTECTED] On Thu, 2002-11-07 at 09:49, [EMAIL PROTECTED] wrote: I've found a little problem that's not explicitly a php problem but I was hoping that php may be the solution. Someone is shown an image and then asked if they wish to change that image. If they answer yes they are taken to an upload form and the new image is upload to the server overwitting the old image using the same filename. They are then taken to a page to show them the image they just uploaded but the old image is diplayed from cache instead of the new photo being shown. I'm using absolute path to the image on the server, not URL. Is there a way to get the script to load in the new photos? Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting multiple images
But I don't think headers would work because I would be using it on a page that has already had output before the images would and also multiple images which means multiple header statements. Ed On Thu, 7 Nov 2002, 1LT John W. Holmes wrote: I've found a little problem that's not explicitly a php problem but I was hoping that php may be the solution. Someone is shown an image and then asked if they wish to change that image. If they answer yes they are taken to an upload form and the new image is upload to the server overwitting the old image using the same filename. They are then taken to a page to show them the image they just uploaded but the old image is diplayed from cache instead of the new photo being shown. I'm using absolute path to the image on the server, not URL. Is there a way to get the script to load in the new photos? I'm sure there are some no-cache header()s you can send. Take a look on the header() manual page, I think there are some examples there. www.php.net/header ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting multiple images
You're just doing a regular img src='/foo/bar.jpg', right? Or do you have a PHP script creating the image for you img src='foo.php?id=1'. If it's the first one, header()s at the top of that page may prevent the page and it's images from being cached. I'm not sure on the specifics of what is/is not cached, sorry. The random number solution may be the best in this case. ---John Holmes... - Original Message - From: [EMAIL PROTECTED] To: 1LT John W. Holmes [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, November 07, 2002 10:01 AM Subject: Re: [PHP] Outputting multiple images But I don't think headers would work because I would be using it on a page that has already had output before the images would and also multiple images which means multiple header statements. Ed On Thu, 7 Nov 2002, 1LT John W. Holmes wrote: I've found a little problem that's not explicitly a php problem but I was hoping that php may be the solution. Someone is shown an image and then asked if they wish to change that image. If they answer yes they are taken to an upload form and the new image is upload to the server overwitting the old image using the same filename. They are then taken to a page to show them the image they just uploaded but the old image is diplayed from cache instead of the new photo being shown. I'm using absolute path to the image on the server, not URL. Is there a way to get the script to load in the new photos? I'm sure there are some no-cache header()s you can send. Take a look on the header() manual page, I think there are some examples there. www.php.net/header ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting multiple images
I think the random number query will work but I have a problem with the context of the echo line. Here's how I get the image path. ? $root_path = /www/special_projects/Elkhart; $agent_url = $root_path/$agent_name; ? img src=? echo $agent_url; ? How would I use the rand function in the above statement? Ed When you create the src tag in for the image, add a random number query string - that will cause the browser to request the image instead of using the cached version. I.e... echo 'img src=/images/image.jpg?'.rand(1000,).''; -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting multiple images
At 16:57 07.11.2002, [EMAIL PROTECTED] spoke out and said: [snip] I think the random number query will work but I have a problem with the context of the echo line. Here's how I get the image path. ? $root_path = /www/special_projects/Elkhart; $agent_url = $root_path/$agent_name; ? img src=? echo $agent_url; ? How would I use the rand function in the above statement? [snip] 1) I believe the root path you gave is the server's file path, not the URL it should point to... well, it just looks like this. 2) code your template like this: img src=?php echo $root_path/$agent_name?r=, random();? This will result in something like img src=/www/special_projects/Elkhart/your.agent.jpg?r=17382 -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/
Re: [PHP] Outputting multiple images
On Thu, 7 Nov 2002, Ernest E Vogelsinger wrote: At 16:57 07.11.2002, [EMAIL PROTECTED] spoke out and said: [snip] I think the random number query will work but I have a problem with the context of the echo line. Here's how I get the image path. ? $root_path = /www/special_projects/Elkhart; $agent_url = $root_path/$agent_name; ? img src=? echo $agent_url; ? How would I use the rand function in the above statement? [snip] 1) I believe the root path you gave is the server's file path, not the URL it should point to... well, it just looks like this. 2) code your template like this: img src=?php echo $root_path/$agent_name?r=, random();? This will result in something like img src=/www/special_projects/Elkhart/your.agent.jpg?r=17382 I got it working by doing thus: img src=? echo $agent_url; ?.jpg?? echo rand(1000,); ? Thanks for all the help guys! Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php