TinyPortal
Development => Block Codes => Topic started by: juggler on January 07, 2006, 12:28:22 AM
OK it's not a coppermine tie in and does mean you'll have to upload the photos to a directory your self. I've used this script on my site for a "Rogues Gallery" of members of the forum. It also allows you to have each photo link to a website individually as well (Although mine all point to my gallery at the moment). To see it in action drop by www.bluebuzzards.com/buzzards.
<script language="JavaScript">
<!--
/*
Random Image Link Script- By JavaScript Kit(http://www.javascriptkit.com)
Over 200+ free JavaScripts here!
Updated: 00/04/25
*/
function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="http://www.bluebuzzards.com/tpimages/Image1.jpg"
myimages[2]="http://www.bluebuzzards.com/tpimages/Image2.jpg"
myimages[3]="http://www.bluebuzzards.com/tpimages/Image3.jpg"
myimages[4]="http://www.bluebuzzards.com/tpimages/Image4.jpg"
myimages[5]="http://www.bluebuzzards.com/tpimages/Image5.jpg"
//specify corresponding links below
var imagelinks=new Array()
imagelinks[1]="http://www.bluebuzzards.com/gallery"
imagelinks[2]="http://www.bluebuzzards.com/gallery"
imagelinks[3]="http://www.bluebuzzards.com/gallery"
imagelinks[4]="http://www.bluebuzzards.com/gallery"
imagelinks[5]="http://www.bluebuzzards.com/gallery"
var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>')
}
random_imglink()
//-->
</script>
<p align="center"><font face="arial" size="-2">This free script provided by</font>
<font face="arial, helvetica" size="-2">JavaScript
Kit (http://javascriptkit.com)</font></p>
I'll try this..
thanks! :)
Handy link to this useful image script |Randomised (http://www.javascriptkit.com/script/cut118.shtml)|
nice script - thanks!
OK, I have the random display of pics setup, but I don't want to resize each picture I put on. What is the right html code to add to the javascript/html box to get a size in there. I currently have the following:
<table>
<tr >
<td width="50" length="50">
<p></p>
<script language="JavaScript">
<!--
/*
Random Image Link Script- By JavaScript Kit(http://www.javascriptkit.com)
Over 200+ free JavaScripts here!
Updated: 00/04/25
*/
function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="../pics/1.jpg"
myimages[2]="../pics/2.jpg"
myimages[3]="../pics/3.jpg"
myimages[4]="../pics/4.jpg"
myimages[5]="../pics/5.jpg"
myimages[6]="../pics/6.jpg"
//specify corresponding links below
var imagelinks=new Array()
imagelinks[1]=""
imagelinks[2]=""
imagelinks[3]=""
imagelinks[4]=""
imagelinks[5]=""
imagelinks[6]=""
var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>')
}
random_imglink()
//-->
</script>
</td>
</tr>
<p></p>
<tr>
<td>
<p align="center"><font face="arial" size="-2">This free script provided by</font>
<font face="arial, helvetica" size="-2">JavaScript
Kit (http://javascriptkit.com)</font></p>
</td>
</tr>
</table>
As you can see I created tables and it still doesn't seem to work. Any suggestions or anytihng you notice I did wrong.
If you have thumbnails to a for each image; just link the random ones to the full size images..i'm pretty sure you need thumbnails as the random in the script/html block..
That won't make any good if I have 100 pictures or more. I have to link up all the images..?
If you want the photos linked to external websites, then, yes, you would have to create links for the images. If you want something else, maybe not.