Problem with updating photos

Problem with updating photos

am 21.01.2008 20:15:24 von Kamyk

Hello all!

I wrote a script to add or update photos no more than 50 KB size. After adding
photo I have possibility to update it (I mean change the photo into the other
one, so not adding another photo). After updating I see still old photo, but
this old photo is enlarged, I mean that this old photo has sizes (widht &
height) of a new photo (just updated) but I still see this old photo, and not a
new photo just updated.

This problem occurs in IE 7.0.. When I update photos in Firefox, everything
works fine. I can add, update photos and always I see proper photos, that is I
see new photos after updating them.

I have such code:

function setExpires($expires) {
header(
'Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
}

setExpires(1);
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');

include ("configuration.php"); //setting session_start() and other things

include ("gallery.php"); //script to add and update photos

?>

and after above code I have such code:




Tytul


I have tried to change header() but it didn`t solve the problem.

Please help me.
Any help apprieciated

Thank you in advance
Marcin.

Re: Problem with updating photos

am 21.01.2008 20:43:34 von Jerry Stuckle

MZ wrote:
> Hello all!
>
> I wrote a script to add or update photos no more than 50 KB size. After
> adding photo I have possibility to update it (I mean change the photo
> into the other one, so not adding another photo). After updating I see
> still old photo, but this old photo is enlarged, I mean that this old
> photo has sizes (widht & height) of a new photo (just updated) but I
> still see this old photo, and not a new photo just updated.
>
> This problem occurs in IE 7.0.. When I update photos in Firefox,
> everything works fine. I can add, update photos and always I see proper
> photos, that is I see new photos after updating them.
>
> I have such code:
>
> > function setExpires($expires) {
> header(
> 'Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
> }
>
> setExpires(1);
> header('Cache-Control: no-store, no-cache, must-revalidate');
> header('Cache-Control: post-check=0, pre-check=0', FALSE);
> header('Pragma: no-cache');
>
> include ("configuration.php"); //setting session_start() and other things
>
> include ("gallery.php"); //script to add and update photos
>
> ?>
>
> and after above code I have such code:
>
>
>
>
> Tytul
>
>
> I have tried to change header() but it didn`t solve the problem.
>
> Please help me.
> Any help apprieciated
>
> Thank you in advance
> Marcin.
>
>

Clear your browser cache. This isn't a PHP problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Problem with updating photos

am 21.01.2008 20:53:17 von Kamyk

U¿ytkownik "Jerry Stuckle" napisa³ w wiadomo¶ci
news:S7-dnS-A-K21awnanZ2dnUVZ_uHinZ2d@comcast.com...
> MZ wrote:
>> Hello all!
>>
>> I wrote a script to add or update photos no more than 50 KB size. After
>> adding photo I have possibility to update it (I mean change the photo into
>> the other one, so not adding another photo). After updating I see still old
>> photo, but this old photo is enlarged, I mean that this old photo has sizes
>> (widht & height) of a new photo (just updated) but I still see this old
>> photo, and not a new photo just updated.
>>
>> This problem occurs in IE 7.0.. When I update photos in Firefox, everything
>> works fine. I can add, update photos and always I see proper photos, that is
>> I see new photos after updating them.
>>
>> I have such code:
>>
>> >> function setExpires($expires) {
>> header(
>> 'Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
>> }
>>
>> setExpires(1);
>> header('Cache-Control: no-store, no-cache, must-revalidate');
>> header('Cache-Control: post-check=0, pre-check=0', FALSE);
>> header('Pragma: no-cache');
>>
>> include ("configuration.php"); //setting session_start() and other things
>>
>> include ("gallery.php"); //script to add and update photos
>>
>> ?>
>>
>> and after above code I have such code:
>>
>>
>>
>>
>> Tytul
>>
>>
>> I have tried to change header() but it didn`t solve the problem.
>>
>> Please help me.
>> Any help apprieciated
>>
>> Thank you in advance
>> Marcin.
>>
>>
>
> Clear your browser cache. This isn't a PHP problem.
>
> --


OK. But I cannot force every user and every visitor of my page to clear cache
everytime they update photo. Is it possible to do it using some code?
Maybe is it possible to implement this in JavaScript?

M.

Re: Problem with updating photos

am 21.01.2008 21:19:13 von Jerry Stuckle

MZ wrote:
>
> U¿ytkownik "Jerry Stuckle" napisa³ w
> wiadomo¶ci news:S7-dnS-A-K21awnanZ2dnUVZ_uHinZ2d@comcast.com...
>> MZ wrote:
>>> Hello all!
>>>
>>> I wrote a script to add or update photos no more than 50 KB size.
>>> After adding photo I have possibility to update it (I mean change the
>>> photo into the other one, so not adding another photo). After
>>> updating I see still old photo, but this old photo is enlarged, I
>>> mean that this old photo has sizes (widht & height) of a new photo
>>> (just updated) but I still see this old photo, and not a new photo
>>> just updated.
>>>
>>> This problem occurs in IE 7.0.. When I update photos in Firefox,
>>> everything works fine. I can add, update photos and always I see
>>> proper photos, that is I see new photos after updating them.
>>>
>>> I have such code:
>>>
>>> >>> function setExpires($expires) {
>>> header(
>>> 'Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
>>> }
>>>
>>> setExpires(1);
>>> header('Cache-Control: no-store, no-cache, must-revalidate');
>>> header('Cache-Control: post-check=0, pre-check=0', FALSE);
>>> header('Pragma: no-cache');
>>>
>>> include ("configuration.php"); //setting session_start() and other
>>> things
>>>
>>> include ("gallery.php"); //script to add and update photos
>>>
>>> ?>
>>>
>>> and after above code I have such code:
>>>
>>>
>>>
>>>
>>> Tytul
>>>
>>>
>>> I have tried to change header() but it didn`t solve the problem.
>>>
>>> Please help me.
>>> Any help apprieciated
>>>
>>> Thank you in advance
>>> Marcin.
>>>
>>>
>>
>> Clear your browser cache. This isn't a PHP problem.
>>
>> --
>
>
> OK. But I cannot force every user and every visitor of my page to clear
> cache
> everytime they update photo. Is it possible to do it using some code?
> Maybe is it possible to implement this in JavaScript?
>
> M.
>
>
>

So, just tell them to clear their cache after uploading. That's what I do.

But I guess you could display the image via a PHP script, and in your
image tag add a dummy query parameter, i.e.



where the id is a unique (or random) number.

I doubt it is possible with javascript, but you can try
comp.lang.javascript. I'd be very upset if some web page cleared my
cache, however, and wouldn't be back.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Problem with updating photos

am 21.01.2008 21:20:43 von Kamyk

U¿ytkownik "MZ" napisa³ w wiadomo¶ci
news:fn2t7i$u6l$1@news.onet.pl...
>
> U¿ytkownik "Jerry Stuckle" napisa³ w wiadomo¶ci
> news:S7-dnS-A-K21awnanZ2dnUVZ_uHinZ2d@comcast.com...
>> MZ wrote:
>>> Hello all!
>>>
>>> I wrote a script to add or update photos no more than 50 KB size. After
>>> adding photo I have possibility to update it (I mean change the photo into
>>> the other one, so not adding another photo). After updating I see still old
>>> photo, but this old photo is enlarged, I mean that this old photo has sizes
>>> (widht & height) of a new photo (just updated) but I still see this old
>>> photo, and not a new photo just updated.
>>>
>>> This problem occurs in IE 7.0.. When I update photos in Firefox, everything
>>> works fine. I can add, update photos and always I see proper photos, that is
>>> I see new photos after updating them.
>>>
>>> I have such code:
>>>
>>> >>> function setExpires($expires) {
>>> header(
>>> 'Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
>>> }
>>>
>>> setExpires(1);
>>> header('Cache-Control: no-store, no-cache, must-revalidate');
>>> header('Cache-Control: post-check=0, pre-check=0', FALSE);
>>> header('Pragma: no-cache');
>>>
>>> include ("configuration.php"); //setting session_start() and other things
>>>
>>> include ("gallery.php"); //script to add and update photos
>>>
>>> ?>
>>>
>>> and after above code I have such code:
>>>
>>>
>>>
>>>
>>> Tytul
>>>
>>>
>>> I have tried to change header() but it didn`t solve the problem.
>>>
>>> Please help me.
>>> Any help apprieciated
>>>
>>> Thank you in advance
>>> Marcin.
>>>
>>>
>>
>> Clear your browser cache. This isn't a PHP problem.
>>
>> --
>
>
> OK. But I cannot force every user and every visitor of my page to clear cache
> everytime they update photo. Is it possible to do it using some code?
> Maybe is it possible to implement this in JavaScript?
>
> M.
>
>


I`ve done this but in the other way:

>>
>> include ("gallery.php"); //script to add and update photos
>>
>> ?>
>>
>> and after above code I have such code:
>>
>>
>>
>>
>> Tytul
>>
>>
>> I have tried to change header() but it didn`t solve the problem.
>>
>> Please help me.
>> Any help apprieciated
>>
>> Thank you in advance
>> Marcin.
>>
>>
>
> Clear your browser cache. This isn't a PHP problem.
>
Yes. Is there a way to tell the browser to 'refresh this file everytime'
in the download?

Re: Problem with updating photos

am 21.01.2008 23:57:31 von Courtney

MZ wrote:
>
> U�ytkownik "MZ" napisa� w wiadomo�ci
> news:fn2t7i$u6l$1@news.onet.pl...
>>
>> U�ytkownik "Jerry Stuckle" napisa� w
>> wiadomo�ci news:S7-dnS-A-K21awnanZ2dnUVZ_uHinZ2d@comcast.com...
>>> MZ wrote:
>>>> Hello all!
>>>>
>>>> I wrote a script to add or update photos no more than 50 KB size.
>>>> After adding photo I have possibility to update it (I mean change
>>>> the photo into the other one, so not adding another photo). After
>>>> updating I see still old photo, but this old photo is enlarged, I
>>>> mean that this old photo has sizes (widht & height) of a new photo
>>>> (just updated) but I still see this old photo, and not a new photo
>>>> just updated.
>>>>
>>>> This problem occurs in IE 7.0.. When I update photos in Firefox,
>>>> everything works fine. I can add, update photos and always I see
>>>> proper photos, that is I see new photos after updating them.
>>>>
>>>> I have such code:
>>>>
>>>> >>>> function setExpires($expires) {
>>>> header(
>>>> 'Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
>>>> }
>>>>
>>>> setExpires(1);
>>>> header('Cache-Control: no-store, no-cache, must-revalidate');
>>>> header('Cache-Control: post-check=0, pre-check=0', FALSE);
>>>> header('Pragma: no-cache');
>>>>
>>>> include ("configuration.php"); //setting session_start() and other
>>>> things
>>>>
>>>> include ("gallery.php"); //script to add and update photos
>>>>
>>>> ?>
>>>>
>>>> and after above code I have such code:
>>>>
>>>>
>>>>
>>>>
>>>> Tytul
>>>>
>>>>
>>>> I have tried to change header() but it didn`t solve the problem.
>>>>
>>>> Please help me.
>>>> Any help apprieciated
>>>>
>>>> Thank you in advance
>>>> Marcin.
>>>>
>>>>
>>>
>>> Clear your browser cache. This isn't a PHP problem.
>>>
>>> --
>>
>>
>> OK. But I cannot force every user and every visitor of my page to
>> clear cache
>> everytime they update photo. Is it possible to do it using some code?
>> Maybe is it possible to implement this in JavaScript?
>>
>> M.
>>
>>
>
>
> I`ve done this but in the other way:
>
> napisa³ w wiadomo¶ci
> news:fn2t7i$u6l$1@news.onet.pl...
>>
>> U¿ytkownik "Jerry Stuckle" napisa³ w
>> wiadomo¶ci news:S7-dnS-A-K21awnanZ2dnUVZ_uHinZ2d@comcast.com...
>>> MZ wrote:
>>>> Hello all!
>>>>
>>>> I wrote a script to add or update photos no more than 50 KB size.
>>>> After adding photo I have possibility to update it (I mean change
>>>> the photo into the other one, so not adding another photo). After
>>>> updating I see still old photo, but this old photo is enlarged, I
>>>> mean that this old photo has sizes (widht & height) of a new photo
>>>> (just updated) but I still see this old photo, and not a new photo
>>>> just updated.
>>>>
>>>> This problem occurs in IE 7.0.. When I update photos in Firefox,
>>>> everything works fine. I can add, update photos and always I see
>>>> proper photos, that is I see new photos after updating them.
>>>>
>>>> I have such code:
>>>>
>>>> >>>> function setExpires($expires) {
>>>> header(
>>>> 'Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
>>>> }
>>>>
>>>> setExpires(1);
>>>> header('Cache-Control: no-store, no-cache, must-revalidate');
>>>> header('Cache-Control: post-check=0, pre-check=0', FALSE);
>>>> header('Pragma: no-cache');
>>>>
>>>> include ("configuration.php"); //setting session_start() and other
>>>> things
>>>>
>>>> include ("gallery.php"); //script to add and update photos
>>>>
>>>> ?>
>>>>
>>>> and after above code I have such code:
>>>>
>>>>
>>>>
>>>>
>>>> Tytul
>>>>
>>>>
>>>> I have tried to change header() but it didn`t solve the problem.
>>>>
>>>> Please help me.
>>>> Any help apprieciated
>>>>
>>>> Thank you in advance
>>>> Marcin.
>>>>
>>>>
>>>
>>> Clear your browser cache. This isn't a PHP problem.
>>>
>>> --
>>
>>
>> OK. But I cannot force every user and every visitor of my page to
>> clear cache
>> everytime they update photo. Is it possible to do it using some code?
>> Maybe is it possible to implement this in JavaScript?
>>
>> M.
>>
>>
>
>
> I`ve done this but in the other way:
>
> Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Problem with updating photos

am 22.01.2008 00:23:06 von Jerry Stuckle

The Natural Philosopher wrote:
> Jerry Stuckle wrote:
>> MZ wrote:
>>> Hello all!
>>>
>>> I wrote a script to add or update photos no more than 50 KB size.
>>> After adding photo I have possibility to update it (I mean change the
>>> photo into the other one, so not adding another photo). After
>>> updating I see still old photo, but this old photo is enlarged, I
>>> mean that this old photo has sizes (widht & height) of a new photo
>>> (just updated) but I still see this old photo, and not a new photo
>>> just updated.
>>>
>>> This problem occurs in IE 7.0.. When I update photos in Firefox,
>>> everything works fine. I can add, update photos and always I see
>>> proper photos, that is I see new photos after updating them.
>>>
>>> I have such code:
>>>
>>> >>> function setExpires($expires) {
>>> header(
>>> 'Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
>>> }
>>>
>>> setExpires(1);
>>> header('Cache-Control: no-store, no-cache, must-revalidate');
>>> header('Cache-Control: post-check=0, pre-check=0', FALSE);
>>> header('Pragma: no-cache');
>>>
>>> include ("configuration.php"); //setting session_start() and other
>>> things
>>>
>>> include ("gallery.php"); //script to add and update photos
>>>
>>> ?>
>>>
>>> and after above code I have such code:
>>>
>>>
>>>
>>>
>>> Tytul
>>>
>>>
>>> I have tried to change header() but it didn`t solve the problem.
>>>
>>> Please help me.
>>> Any help apprieciated
>>>
>>> Thank you in advance
>>> Marcin.
>>>
>>>
>>
>> Clear your browser cache. This isn't a PHP problem.
>>
> Yes. Is there a way to tell the browser to 'refresh this file everytime'
> in the download?
>

No. All you can do is recommend. The browser is free to accept or
reject the recommendation.

Also, you can't do it for images without sending a custom header - which
means a PHP script to serve the image.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Problem with updating photos

am 22.01.2008 01:38:36 von Michael Fesser

..oO(The Natural Philosopher)

>Yes. Is there a way to tell the browser to 'refresh this file everytime'
>in the download?

You don't want the browser to download it everytime, but instead to ask
the server if the image was changed. Of course this requires proper HTTP
headers to control the caching. For static images the server usually
does this already (Apache servers for example send Last-Modified and
ETag headers), but it also depends on the browser to respect them.

Caching Tutorial
http://www.mnot.net/cache_docs/

Micha