Jump to content

Page refresh issues


chomedey

Recommended Posts

I feel I'm over-using this site today but here goes ...

 

I have a social networking site where people register, at which point a profile page is created that includes a silhouette head shot image, which is assigned the name 'their_username.jpg'.

 

The user can then click on that image, which takes them to an 'upload photo' page.  Once they have uploaded and cropped their photo, it is assigned the name 'their_username.jpg' and it now shows on their profile page.

 

The only problem is that both on the initial image upload, and after the cropping, the old image, cached in the browser, displays.

 

Right now I have an excuse line - 'if you do not see your image here hit the reload button on your browser' - but I would much rather have php automatically empty the old image from the cache before they upload a new one.

 

Can php do this?

 

Thanks.

 

Julian

Link to comment
Share on other sites

I feel I'm over-using this site today but here goes ...

 

I have a social networking site where people register, at which point a profile page is created that includes a silhouette head shot image, which is assigned the name 'their_username.jpg'.

 

The user can then click on that image, which takes them to an 'upload photo' page.  Once they have uploaded and cropped their photo, it is assigned the name 'their_username.jpg' and it now shows on their profile page.

 

The only problem is that both on the initial image upload, and after the cropping, the old image, cached in the browser, displays.

 

Right now I have an excuse line - 'if you do not see your image here hit the reload button on your browser' - but I would much rather have php automatically empty the old image from the cache before they upload a new one.

 

Can php do this?

 

Thanks.

 

Julian

 

PHP is a server side language. Keeping this in mind any functions relating to changing the state of the user's web browser is not possible. Read here for a way to prevent the user from storing the page in cache in the first place

 

http://support.microsoft.com/kb/222064/

Link to comment
Share on other sites

Load your image through PHP that way you can add additional headers to expire the image instead of not caching the entire page.

 

EDIT: apparently that doesn't work in all browsers use

 

their_username.jpg?<?php print time(); ?>

 

EDIT 2: Google doesn't like this

 

their_username-<timestamp>.jpg

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.