Welcome Guest, Not a member yet? Register   Sign In
Image Problem!
#1

[eluser]Lazos[/eluser]
Hi. Maybe this forum is not the right one for this question. I hope somebody will answer though.

I have a script that resize and rotate images. I am using an iframe for viewing the images and I have small thumbnails for every image using the image manipulation class of CI. Below them I have small icons for rotating and resizing the image.

Anyway when I rotate something and even I have the refresh or location redirect inside the iframe images do not change to their new state after rotation. I need to refresh the iframe manually in order to see the changes.

Do you know how to fix this problem?
(Is it because the browser is caching images and because even I rotate or resize I keep the same name browser still things is the same image?)

I hope somebody can help me.
Thanks.
#2

[eluser]Jelmer[/eluser]
I had the same problem and the fix was pretty easy once I figured it out.

Instead of using:
Code:
echo '<img src="path/to/your/image.jpg" alt="" />';

Use:
Code:
echo '<img src="path/to/your/image.jpg?'.time().'" alt="" />';

Even though it's the same image the ? and the number behind it make the browser consider it a new image.
#3

[eluser]narkaT[/eluser]
additional you can send some headers to prevent caching:

Code:
Cache-Control: no-cache, must-revalidate
Expires: Mon, 26 Jul 1997 05:00:00 GMT

so you can prevent that the cache of "whatever gets in contact with that request" (proxy's etc..)
gets flooded with "new images" Smile
#4

[eluser]Jelmer[/eluser]
Thought about that, but for this instance I prefer this solution because it only reloads the image I want, and it gets the stylesheet and interface images without checking from the cache. It's just a little bit faster.




Theme © iAndrew 2016 - Forum software by © MyBB