It is currently Thu Nov 27, 2014 10:35 pm Advanced search

Troubled by Cached Images

Technical support, bug reports, feature requests and more.

Troubled by Cached Images

Postby Len » Wed Sep 19, 2007 7:47 am

Does anyone experience the same problem as I do? Here it is:

Suppose I have an image with size 300x450. Highslide works fine. Now I replace this image with a larger one, say 400x600 (with the same file name). However, everytime I click on the thumbnail, highslide still shows the old smaller image. I have tried refreshing, closing/relaunching the browser, cleaning up the cache files, I even reboot the computer, but the old image refused to away. How am I able to see the new image?

Thanks
Len
Len
 
Posts: 6
Joined: Sun Jul 29, 2007 8:06 am
Location: California

Postby torstein.honsi » Wed Sep 19, 2007 11:11 am

It is a common problem that IE remembers the size of the image. The fix is to uncomment line 798 in highslide.js, run the expander in IE, then comment it back again.
Code: Select all
    // uncomment this to flush img size:
    // if (hs.ie) img.src = null;
User avatar
torstein.honsi
Site Admin
 
Posts: 9201
Joined: Thu Nov 09, 2006 1:22 pm
Location: Vik i Sogn, Norway

Postby Len » Thu Sep 20, 2007 6:34 am

Thanks, Torstein. What's the consequence if I leave this line permanently uncomment?
Len
 
Posts: 6
Joined: Sun Jul 29, 2007 8:06 am
Location: California

Postby torstein.honsi » Thu Sep 20, 2007 11:15 pm

The concequence is that you server will get a lot of requests for a file called 'null'.
User avatar
torstein.honsi
Site Admin
 
Posts: 9201
Joined: Thu Nov 09, 2006 1:22 pm
Location: Vik i Sogn, Norway

Postby torstein.honsi » Fri Feb 29, 2008 7:22 pm

Update Feb 29 2008:
See hs.flushImgSize
User avatar
torstein.honsi
Site Admin
 
Posts: 9201
Joined: Thu Nov 09, 2006 1:22 pm
Location: Vik i Sogn, Norway

Postby Exo » Fri Feb 29, 2008 8:53 pm

This is a great addition - I've had problems with IE during development of a web site and it remembering image sizes, I thought it was IIS or something else until I found Firefox was fine.
Nice work - ideal feature to use locally at least during development of a site/
User avatar
Exo
 
Posts: 103
Joined: Fri Nov 23, 2007 7:03 pm

Postby torstein.honsi » Sat Mar 01, 2008 11:07 pm

Thanks Exo, I noticed more and more users experience this wierd IE bug, so I made the workaround a part of the documented API. As you say it should be used only while developing, and removed later. If it isn't, IE users will trigger a "null" file request and a 404 on your server.
User avatar
torstein.honsi
Site Admin
 
Posts: 9201
Joined: Thu Nov 09, 2006 1:22 pm
Location: Vik i Sogn, Norway

Better you solve the cache-problem for all users!

Postby guenter55 » Fri Apr 18, 2008 6:36 pm

Hi,
I hope I understand your solution. This solves the problem just for yourself.

But all other visitors of your website have the same problem too. When the page is loaded, IE takes the former image-size from cache.

You can solve the problem for yourself and all your visitors as follows:


IE takes the correct/new image-size if you link the picture a "?" and a random number at the end, i.e. mypicture.jpg?...
The number at the end must always be a different one. The best way doing this is to use a timestamp:

Change your site-extension from *.htm to *.php, put in the htm-source this php-snippet:



Code: Select all
<?php $timestamp = time(); ?>
<a id="thumbxxxx" href="images/fullxxxx.jpg?var=$timestamp" class="highslide" onclick="return hs.expand(this)">
   <img src="images/thumbxxxx.jpg" alt="Highslide JS"
   title="" width="150" /></a>




so you have to make sure there is always a different number at the end of the link.
You can also code it in javascript.

Und hier f├╝r die lieber deutsch lesenden:

(Cache-Problem l├Âsen wenn in Gr├Â├ƒe ge├ñndertes Bild verzerrt mit alter Bildgr├Â├ƒe dargestellt wird)
Ich hoffe, ich habe den Thread richtig verstanden! Die hier vorgestellte L├Âsung kann man nur f├╝r sich selbst anwenden. Aber alle User der Website haben das gleiche Problem, einmal die Site aufgerufen ist die Gr├Â├ƒe des Bildes im cache des IE, wird die Bildgr├Â├ƒe dann ge├ñndert und der User ruft die Seite nochmal auf, dann sieht er das Bild in den falschen fr├╝heren Ausma├ƒen.

Hier die L├Âsung:
Dem link zum Bild ist einfach am Ende mit "?" (ohne Anführungszeichen) eine zufällige Zahl anzuhängen, zB. meinbild.jpg?12345.

Das alleine reicht nicht, denn die Zahl muss immer unterschiedlich sein! Am Besten geht das, wenn man einen Timestamp anhängt:

Wenn man php verwenden kann, ändert man die Extension der site von *.htm auf *.php und schreibt in den html-source folgenden code:
Code: Select all
siehe vorhin


Genauso kann man das auch mit javascript l├Âsen.

Best regards
Guenter
guenter55
 
Posts: 1
Joined: Fri Apr 18, 2008 5:44 pm

Re: Better you solve the cache-problem for all users!

Postby EarlyOut » Fri Apr 18, 2008 9:35 pm

guenter55 wrote:But all other visitors of your website have the same problem too. When the page is loaded, IE takes the former image-size from cache.
Only if you, the web page designer, keep replacing the image with one with the same name, but of a different size.
User avatar
EarlyOut
 
Posts: 1705
Joined: Sun Nov 11, 2007 11:22 pm
Location: Sector R

Postby torstein.honsi » Mon Apr 21, 2008 11:00 am

EarlyOut is right. This problem occurs when implementers are testing Highslide with different image sizes, so the fix is aimed at the implementer. The end user doesn't have this problem.

Of course if you deliberately design your page so that the image size varies within the file name, you can use the PHP timestamp option.
User avatar
torstein.honsi
Site Admin
 
Posts: 9201
Joined: Thu Nov 09, 2006 1:22 pm
Location: Vik i Sogn, Norway


Return to Highslide JS Usage

Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot], Google [Bot] and 3 guests