PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Problem with updating photos
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Problem with updating photos

Réponse
 
LinkBack Outils de la discussion
Vieux 21/01/2008, 19h15   #1
MZ
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Problem with updating photos

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:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Tytul</TITLE>


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

Please me.
Any apprieciated

Thank you in advance
Marcin.

  Réponse avec citation
Vieux 21/01/2008, 19h43   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with updating photos

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:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML>
> <HEAD>
> <TITLE>Tytul</TITLE>
>
>
> I have tried to change header() but it didn`t solve the problem.
>
> Please me.
> Any 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
==================

  Réponse avec citation
Vieux 21/01/2008, 19h53   #3
MZ
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with updating photos


U¿ytkownik "Jerry Stuckle" <jstucklex@attglobal.net> 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:
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>> <HTML>
>> <HEAD>
>> <TITLE>Tytul</TITLE>
>>
>>
>> I have tried to change header() but it didn`t solve the problem.
>>
>> Please me.
>> Any 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.


  Réponse avec citation
Vieux 21/01/2008, 20h19   #4
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with updating photos

MZ wrote:
>
> U¿ytkownik "Jerry Stuckle" <jstucklex@attglobal.net> 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:
>>>
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>>> <HTML>
>>> <HEAD>
>>> <TITLE>Tytul</TITLE>
>>>
>>>
>>> I have tried to change header() but it didn`t solve the problem.
>>>
>>> Please me.
>>> Any 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.

<img src="/images/showpicture.php?pix=filename.jpg&id=12345">

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
==================

  Réponse avec citation
Vieux 21/01/2008, 20h20   #5
MZ
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with updating photos


U¿ytkownik "MZ" <marcinzmyslowski@poczta.onet.pl> napisa³ w wiadomo¶ci
news:fn2t7i$u6l$1@news.onet.pl...
>
> U¿ytkownik "Jerry Stuckle" <jstucklex@attglobal.net> 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:
>>>
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>>> <HTML>
>>> <HEAD>
>>> <TITLE>Tytul</TITLE>
>>>
>>>
>>> I have tried to change header() but it didn`t solve the problem.
>>>
>>> Please me.
>>> Any 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:

<img src="images/galeria/zdjecie.jpg?<?=time(); ?>

It works

Thank you in advance
Marcin

  Réponse avec citation
Vieux 21/01/2008, 22h56   #6
The Natural Philosopher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with updating photos

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:
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>> <HTML>
>> <HEAD>
>> <TITLE>Tytul</TITLE>
>>
>>
>> I have tried to change header() but it didn`t solve the problem.
>>
>> Please me.
>> Any 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?
  Réponse avec citation
Vieux 21/01/2008, 22h57   #7
The Natural Philosopher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with updating photos

MZ wrote:
>
> U�ytkownik "MZ" <marcinzmyslowski@poczta.onet.pl> napisa� w wiadomo�ci
> news:fn2t7i$u6l$1@news.onet.pl...
>>
>> U�ytkownik "Jerry Stuckle" <jstucklex@attglobal.net> 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:
>>>>
>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>>>> <HTML>
>>>> <HEAD>
>>>> <TITLE>Tytul</TITLE>
>>>>
>>>>
>>>> I have tried to change header() but it didn`t solve the problem.
>>>>
>>>> Please me.
>>>> Any 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:
>
> <img src="images/galeria/zdjecie.jpg?<?=time(); ?>
>
> It works
>
> Thank you in advance
> Marcin


Neat trick Marcin. Another one to remember.
  Réponse avec citation
Vieux 21/01/2008, 23h21   #8
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with updating photos

MZ wrote:
>
> U¿ytkownik "MZ" <marcinzmyslowski@poczta.onet.pl> napisa³ w wiadomo¶ci
> news:fn2t7i$u6l$1@news.onet.pl...
>>
>> U¿ytkownik "Jerry Stuckle" <jstucklex@attglobal.net> 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:
>>>>
>>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>>>> <HTML>
>>>> <HEAD>
>>>> <TITLE>Tytul</TITLE>
>>>>
>>>>
>>>> I have tried to change header() but it didn`t solve the problem.
>>>>
>>>> Please me.
>>>> Any 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:
>
> <img src="images/galeria/zdjecie.jpg?<?=time(); ?>
>
> It works
>
> Thank you in advance
> Marcin
>


It will work, but it will eliminate all caching of the image by the
client. The result can be a fair increase in required bandwidth, plus
slower loading for the client.

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

  Réponse avec citation
Vieux 21/01/2008, 23h23   #9
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with updating photos

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:
>>>
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>>> <HTML>
>>> <HEAD>
>>> <TITLE>Tytul</TITLE>
>>>
>>>
>>> I have tried to change header() but it didn`t solve the problem.
>>>
>>> Please me.
>>> Any 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
==================

  Réponse avec citation
Vieux 22/01/2008, 00h38   #10
Michael Fesser
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with updating photos

..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
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 12h25.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,28438 seconds with 18 queries