Page 1 of 1
Random image
Posted: Sun May 29, 2016 1:09 pm
by wads24
I have put the random image script a few times on one webpage. Right now it shows the same image over and over on the same webpage. Is there a modification that I could do to the script that will ensure that a new random image is displayed every time?
Re: Random image
Posted: Sun May 29, 2016 1:58 pm
by Klemen
Why don't you post your website URL so we can check if the script is called correctly?
Also, if your server has any code caching enabled, try disabling it for the folder where random image script is located.
Re: Random image
Posted: Wed Sep 27, 2017 3:52 pm
by The Dabbler
I added the following to the beginning of the randim.php file to stop the generated images from being cached:
header("Content-type: image/png");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
For other image types, just change the content-type accordingly, e.g. image/gif