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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.