Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
A utility that helps display random images every time the page loaded
Old 04-26-2005, 08:49 PM A utility that helps display random images every time the page loaded
Experienced Talker

Posts: 41
Trades: 0
Hey !

Can anyone recommend a good utility that helps display random images/quickTime clips every time the page gets loaded ?

Thanks for your help
grace04 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-27-2005, 01:24 AM
pr0jekt's Avatar
Skilled Talker

Posts: 60
Location: Victor Harbor, South Australia
Trades: 0
Ive created two scripts for you, one displays gifs, jpegs etc and one displays quicktime movies for you, if you like i can create a hybrid of both but you can simply as for that in this topic if youd like it

ok, heres the normal GIF, JPEG, PNG script
Code:
<script language="javascript" type="text/javascript">
	yourImageList = new Array("image1.gif" , "image2.jpg" , "image3.gif" , "helloworld.jpg");
	num = (Math.floor(Math.random()*(yourImageList.length)));
	document.write("<img src=\"" + yourImageList[num] + "\" alt=\"Random Image\" />");
</script>

and heres the quicktime one

Code:
<script language="javascript" type="text/javascript">
	yourQTMovieList = new Array("Movie1.mov" , "Movie2.mov");
	num = (Math.floor(Math.random()*(yourQTMovieList.length)));
	widthOfMovie = 100;
	heightOfMovie = 100;
	
	document.write("<OBJECT CLASSID='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' WIDTH='" + heightOfMovie + "' HEIGHT='" + widthOfMovie + "' CODEBASE='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'><PARAM NAME='controller' VALUE='TRUE'><PARAM NAME='type' VALUE='video/quicktime'><PARAM NAME='autoplay' VALUE='true'><PARAM NAME='target' VALUE='myself'><PARAM NAME='src' VALUE='" + yourQTMovieList[num] + "'><PARAM NAME='pluginspage' VALUE='http://www.apple.com/quicktime/download/indext.html'>			<EMBED WIDTH='" + widthOfMovie + "' HEIGHT='" + heightOfMovie + "' CONTROLLER='TRUE' TARGET='myself' SRC='" + yourQTMovieList[num] + "' type='video/quicktime' BGCOLOR='#000000' BORDER='0' PLUGINSPAGE='http://www.apple.com/quicktime/download/indext.html'></EMBED></OBJECT>");
</script>

like i said i can create you a hybrid of both if you would like, i can also make it into a php version if youd like
__________________

Please login or register to view this content. Registration is FREE


Im new here so play nice :)

Last edited by pr0jekt; 04-27-2005 at 01:27 AM..
pr0jekt is offline
Reply With Quote
View Public Profile Visit pr0jekt's homepage!
 
Old 04-27-2005, 04:10 PM
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
To Expand on this topic, can you show me how to do this using php? Another words what I want to achieve is a random product with description, price, link to details page & price from mysql database to show up on a page...Similar to how http://www.christmasdepot.com has their featured product box.

Thank you!
-Brian
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
Old 04-27-2005, 08:42 PM
pr0jekt's Avatar
Skilled Talker

Posts: 60
Location: Victor Harbor, South Australia
Trades: 0
which version did u want, the image one , quicktime or both?
__________________

Please login or register to view this content. Registration is FREE


Im new here so play nice :)
pr0jekt is offline
Reply With Quote
View Public Profile Visit pr0jekt's homepage!
 
Old 04-28-2005, 02:02 PM
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
the image version
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
Old 04-28-2005, 09:06 PM
pr0jekt's Avatar
Skilled Talker

Posts: 60
Location: Victor Harbor, South Australia
Trades: 0
no probs itll take a few mins
__________________

Please login or register to view this content. Registration is FREE


Im new here so play nice :)
pr0jekt is offline
Reply With Quote
View Public Profile Visit pr0jekt's homepage!
 
Old 04-28-2005, 09:13 PM
pr0jekt's Avatar
Skilled Talker

Posts: 60
Location: Victor Harbor, South Australia
Trades: 0
this should do the trick
PHP Code:
<?php
    $yourImageList 
= Array("image1.gif" "image2.jpg" "image3.gif" "helloworld.jpg");
    
$num mt_rand(0,count($yourImageList)-1)  ;
    echo 
$num;
    echo 
"<img src=\"" $yourImageList[$num] + "\" alt=\"Random Image\" />";
?>
__________________

Please login or register to view this content. Registration is FREE


Im new here so play nice :)
pr0jekt is offline
Reply With Quote
View Public Profile Visit pr0jekt's homepage!
 
Old 04-28-2005, 11:22 PM
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
Yeah, but how about if the images are stored in MySQL Database? Basically, I want to have a 'featured product' table on my homepage with a random image that's stored in my SQL database, along with some other random information from the database like the title, description, price, etc..

Thank you in advance!

-Brian
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to A utility that helps display random images every time the page loaded
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26759 seconds with 12 queries