/    Sign up×
Community /Pin to ProfileBookmark

Random images with url and title fields

Is there a way to make a random image script that would also allow me to display other related information such as the title and a link to the original photo on flickr?

To date I have been using the following for the random images, and if possible store the information in a text file as opposed to a DB table.

[code]
<?php

$total = “11”;

$file_type = “.jpg”;

$image_folder = “images/random”;

$start = “1”;

$random = mt_rand($start, $total);

$image_name = $random . $file_type;

echo “<img src=”$image_folder/$image_name” alt=”$image_name” />”;

?>
[/code]

my intention is to use locally stored thumbnails to link to the original images on Flickr.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@olafDec 31.2007 — do you have a rss feed for your images on flickr?
Copy linkTweet thisAlerts:
@Mouse77eauthorDec 31.2007 — Thats the thing Olaf, they are not all my images. i have asked variouse members on Flickr to use their images and where they have kindly said yes it has been on the previso that i'd link back to the origional...
Copy linkTweet thisAlerts:
@blue-eye-labsDec 31.2007 — you could do it easily with SQL ("SELECT * FROM table ORDER BY RAND() LIMIT 1" or something like that)... with PHP there must be a random number function, which it seems like you already have... as far as storing it in a text file, maybe store it in an XML file? I looked around and found this, which seems to be the right thing: http://www.ibm.com/developerworks/library/os-xmldomphp/
Copy linkTweet thisAlerts:
@olafDec 31.2007 — Thats the thing Olaf, they are not all my images. i have asked variouse members on Flickr to use their images and where they have kindly said yes it has been on the previso that i'd link back to the origional...[/QUOTE]


then you need to collect all the data, put them into an array or database
×

Success!

Help @Mouse77e spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...