Random image

In case you have problems with some other PHPJunkyard script (not that there are THAT many).
Post Reply
wads24
Posts: 4
Joined: Fri Aug 16, 2013 7:07 am

Random image

Post 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?
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Random image

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
The Dabbler
Posts: 1
Joined: Wed Sep 27, 2017 3:43 pm

Re: Random image

Post 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
Post Reply