chomedey Posted March 29, 2010 Share Posted March 29, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/196894-page-refresh-issues/ Share on other sites More sharing options...
aeroswat Posted March 29, 2010 Share Posted March 29, 2010 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/ Quote Link to comment https://forums.phpfreaks.com/topic/196894-page-refresh-issues/#findComment-1033715 Share on other sites More sharing options...
chomedey Posted March 29, 2010 Author Share Posted March 29, 2010 Hi. That's great. Works well. Now I have to decide if it's worth the cost of the page taking longer to load every time it displays. Many thanks. Julian Quote Link to comment https://forums.phpfreaks.com/topic/196894-page-refresh-issues/#findComment-1033754 Share on other sites More sharing options...
ignace Posted March 29, 2010 Share Posted March 29, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/196894-page-refresh-issues/#findComment-1033774 Share on other sites More sharing options...
chomedey Posted March 29, 2010 Author Share Posted March 29, 2010 Hi, Not quite understanding this ... Quote Link to comment https://forums.phpfreaks.com/topic/196894-page-refresh-issues/#findComment-1033786 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.