Jump to content

Inserting Random Image "Permanently"


Dodoz

Recommended Posts

I'm attempting to set up a script that will choose a "random" image from a directory and then place it in an article when it's posted. I currently have a php file that randomly assigns a picture on each refresh, however my employer wants the image to be static after posting. So I guess the short of my question is, what would be the best way to go about something like that or is it even doable with PhP.

Link to comment
https://forums.phpfreaks.com/topic/210675-inserting-random-image-permanently/
Share on other sites

Just a quick suggestion. If your articles are being pulled from a database, you could set it up so that there is a "picID" field, or what ever you use for getting the random pick, then run an IF . . . ELSE statement.

 

The IF/ELSE statement could check to see if an image is already set to an article, set it if it is not and it should keep the picture with the article.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.