Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 1st, 2007, 07:01 AM
Authorized User
 
Join Date: Oct 2006
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to snowbydave1
Default Browser cannot display fresh image.

Dear Friends,


I have developed site which will gives effect on a image with the help of image_filter() of PHP 5.2. eg contract, grey scale, emboss etc...

Effect applied properly on image, but IE cannot refresh this page until I press F5 key. However this code works fine with FireFox, NetScape, Opera.

To overcome from this problem I had go to settings of IE & select on Every time I visit the Page radio button instead of Automatically under Check for newer version of stored page section.

But end user does not have this idea. So is there is any way to solve this with PHP, JS, HTML ?


Thanking you,


Dhaval Dave



 
Old March 21st, 2007, 07:41 PM
Registered User
 
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

One way to combat this is to attach something different to the page each time it refreshes.

index.php?dummy=1
when this gets called IE caches "index.php?dummy=1234" as the loaded page
so if you call
index.php?dummy=2
even though it is still displaying the same page it will cause it to reload because the dummy variable in the url changed.
I have used mktime() to accomplish this when i needed too.

Hope this helps.
 
Old March 22nd, 2007, 07:17 AM
Authorized User
 
Join Date: Mar 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

directly from http://www.php.net/manual/en/function.header.php ....

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

This tells the client "DON'T CACHE MY PAGE, FOR THE LOVE OF GOD, DON'T CACHE MEEEE"

 
Old March 23rd, 2007, 08:37 AM
Authorized User
 
Join Date: Oct 2006
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to snowbydave1
Default

Dear Friend,

Kindly thanks for your response. Well sir below code will not work I had already try it before few week.

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>


index.php?dummy=1 this will also not work. Problem is only raised with IE browser. While it will work nice with FireFox, NetScape.

Plese guide me more.

Thanking you,


Snowby Dave


 
Old March 23rd, 2007, 08:44 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

IE and Firefox handle cache differently (as you have no doubht figured out). With IE you need to add the Pragma header and read this article on it:

http://www.w3schools.com/php/func_http_header.asp

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old March 23rd, 2007, 08:46 AM
Registered User
 
Join Date: Mar 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The above header recommendations should work as well....
to continue my idea...
When the writing the link that goes to the page give this a try
<a href="page.php?d=<?php echo mktime(); ?>">Link To Page</a>
This will make the link different every time which will cause ie to think it is a new page.
You can even add a md5() around the mktime to make it not look like a timestamp.
Greg
 
Old March 24th, 2007, 04:55 AM
Authorized User
 
Join Date: Oct 2006
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to snowbydave1
Default

Dear gwhitehead,

My page contain one original image & beside it, it has another image. This image will change when user click on a grey, emboss, smooth, edges, negative text box. When I click on grey button. Image is already converted to Grey in folder. But it will not display grey image on browser. It will display old image until I press F5 or Refresh page.

With url I am passing step parameter with url for keep step track. So anytime user can undo his step. So my url looks like following way

index.php?fn=FILENAME&step=STEP_NO

STEP_NO is increament or decrement, so each time url change. Your <a href="page.php?d=<?php echo mktime(); ?>"> link will not work. I mrsn I had added d=<?php echo mktime(); ?>. But still I have to press F5.

Please guide me more...






Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload image-create & save thumbnail-display image angshujit ASP.NET 2.0 Professional 6 July 11th, 2013 10:34 PM
Browser cannot display fresh image. snowbydave1 PHP FAQs 0 March 1st, 2007 07:11 AM
Display Excel Workbook in browser roopsk C++ Programming 0 August 8th, 2006 06:34 AM
How to Display the image from the image field. mikeparams SQL Server 2000 1 October 29th, 2004 02:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.