Dodoz Posted August 13, 2010 Share Posted August 13, 2010 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. Quote Link to comment Share on other sites More sharing options...
hcdarkmage Posted August 13, 2010 Share Posted August 13, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.