PDA

View Full Version : Image Thumbnail Viewer II



LJ2K
03-30-2006, 09:52 PM
I've just finished adding the script to my site and can't figure out why the images aren't showing on the page. This the code I used:

In the head;-

<script type="text/javascript">

//Specify image paths and optional link (set link to "" for no link):
var dynimages=new Array()
dynimages[0]=["sample1.png", ""]
dynimages[1]=["sample2.png", ""]
dynimages[2]=["sample3.png", ""]
dynimages[3]=["sample4.png", ""]
dynimages[4]=["sample5.png", ""]
dynimages[5]=["sample6.png", ""]

//Preload images ("yes" or "no"):
var preloadimg="yes"

//Set optional link target to be added to all images with a link:
var optlinktarget=""

//Set image border width
var imgborderwidth=0

//Optionally, change 1.0 and 0.7 below to affect Wipe gradient size and duration in seconds in IE5.5+:
var filterstring="progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)"

///////No need to edit beyond here/////

if (preloadimg=="yes"){
for (x=0; x<dynimages.length; x++){
var myimage=new Image()
myimage.src=dynimages[x][0]
}
}

function returnimgcode(theimg){
var imghtml=""
if (theimg[1]!="")
imghtml='<a href="'+theimg[1]+'" target="'+optlinktarget+'">'
imghtml+='<img src="'+theimg[0]+'" border="'+imgborderwidth+'">'
if (theimg[1]!="")
imghtml+='</a>'
return imghtml
}

function modifyimage(loadarea, imgindex){
if (document.getElementById){
var imgobj=document.getElementById(loadarea)
if (imgobj.filters && window.createPopup){
imgobj.style.filter=filterstring
imgobj.filters[0].Apply()
}
imgobj.innerHTML=returnimgcode(dynimages[imgindex])
if (imgobj.filters && window.createPopup)
imgobj.filters[0].Play()
return false
}
}

</script>

In the body;-

<CENTER><a href="sample1.png" onMouseover="modifyimage('dynloadarea', 0)"><IMG SRC="sample1.png"></a>
<a href="sample2.png" onMouseover="modifyimage('dynloadarea', 1)"><IMG SRC="sample2.png"></a>
<a href="sample3.png" onMouseover="modifyimage('dynloadarea', 2)"><IMG SRC="sample3.png"></a>
<a href="sample4.png" onMouseover="modifyimage('dynloadarea', 3)"><IMG SRC="sample4.png"></a>
<a href="sample5.png" onMouseover="modifyimage('dynloadarea', 4)"><IMG SRC="sample5.png"></a>
<a href="sample6.png" onMouseover="modifyimage('dynloadarea', 5)"><IMG SRC="sample6.png"></a>
<br>
<div id="dynloadarea" style="width:80px;height:225px"></div></CENTER>

The images are in the root directory with the page, but aren't showing up... Anyone had a similar problem (or noticed a mistake I've missed)? :eek: :confused:

Oh, by the way, the "big grin" image shouldn't be there, it's actually the : and D that are right next to each other!

jscheuer1
03-30-2006, 10:18 PM
If that's your site, linked at the bottom of your post, your upload was bad or the file was bad to begin with, I'm getting:


The image “http://wearewatching.5000megs.com/sample1.png” cannot be displayed, because it contains errors.

In FF.

If that's not your site, I need your site's URL and preferably a link to the problem page to figure it out.

LJ2K
04-03-2006, 09:31 PM
I've just been notified that the problems caused by my host, apparently PNG's (the type of images I used for the script) take up too much bandwidth so they get blocked by the 'on board software'! Ironically they do allow BMP's, hmm..... :eek: :eek: :confused: :confused:

Thanks anyway jscheuer1 for trying to help.

jscheuer1
04-04-2006, 03:03 AM
Well, for graphics, a .gif is similar and for pictures, .jpg is good. I think the .png ban is stupid. A more intelligent way for the host to deal with this would be simply to limit file size. Any graphic in any format can take up too much space and/or bandwidth.