I am using Thumbshots.org previews. Sometimes there are no thumbshots available and I would like to put in a conditional statement if possible, so that if no thumb is available, then a replacement image is posted in its place - how can I code this?
The code to display the thumbs is:
<img src="http://open.thumbshots.org/image.pxf?url={LINKURL}" onload="if (this.width>50) this.border=1; this.alt='Thumbnails by Thumbshots.org'">
Am unsure how to use an IF statement to replace empty thumbs with another image, or even nothing in its place, instead of the red X you get for a broken image at the moment...
apparently I am dumber than I thought; after many changes this is what I have and it doesn't work: <img src="http://open.thumbshots.org/image.pxf?url={LINKURL}" onload="if (this.width>50) this.border=1; this.alt='{LINKTITLE} Thumbnails by Thumbshots.org', if (this.width < 50) this.src='/images/noimage-aol.gif'; this.alt='No {LINKTITLE} preview yet'; this width='120' height='90'"> </a>
can someone please tell me exactly when I need to change ? Sorry and thank you again
would I be pushing my luck to try to get the width='' and height='' for both images? I tried but didn't work so I am not sure if it's even possible. The problem is the classic tag problem that while the image is loaded the page is drawn and once it loads it "moves" as it expands to make room for it.
<img src="http://open.thumbshots.org/image.pxf?url={LINKURL}" alt='{LINKTITLE} Thumbnails by Thumbshots.org' border='1' onload="if (this.width < 50) this.src='/path/wsnlinks/templates/multilingual/images/noimage-aol.gif'"> any suggestions?
I realize that this discussion is more than a year old and apparently the thumbshot code (?) has changed since then, because the replacement image from thumbshot unfortunately has the same size as the previews have. Any idea how to replace the image in a different way?
Thumbshots.org took to using the advertisement replacement image as basically a way to sell people their thumbshots.com service which allows you to set your own replacement image. No way around it without paying them that I can see.
"No way around it without paying them that I can see."
Of course, that's what they all do. Exactly the reason why I dropped that other thumb preview service. Ads everywhere... It just looks stupid when more than half of the thumbs in a category don't really work And I have to figure out how often they refresh those previews - A LOT of them don't even seem to be related to the actual topic of the website. Maybe I have to go back to using the 100x35 buttons after all ...
Comments on How to replace empty thumbshot image?
Forum Regular
Usergroup: Customer
Joined: Aug 05, 2005
Total Topics: 94
Total Comments: 272
I am using Thumbshots.org previews. Sometimes there are no thumbshots available and I would like to put in a conditional statement if possible, so that if no thumb is available, then a replacement image is posted in its place - how can I code this?
The code to display the thumbs is:
Am unsure how to use an IF statement to replace empty thumbs with another image, or even nothing in its place, instead of the red X you get for a broken image at the moment...
Thanks for any help.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Does thumbshots offer some way for you to get a value stating that the image is or isn't available?
Forum Regular
Usergroup: Customer
Joined: Aug 05, 2005
Total Topics: 94
Total Comments: 272
ok this is the way to do it, for the benefit of anyone else using this feature:
<img src="thumsbhots code here" onload="if (this.width < 50) this.src='URL to alternate image'" />
Member
Usergroup: Customer
Joined: May 13, 2007
Total Topics: 16
Total Comments: 37
<img src="http://open.thumbshots.org/image.pxf?url={LINKURL}" onload="if (this.width>50) this.border=1; this.alt='{LINKTITLE} Thumbnails by Thumbshots.org'" onload="if (this.width < 50) this.src='/images/no-image.gif' width='120' height='90'"> </a>
OK, what am I doing wrong ? It works fine when there is a thumsbhot, but all I see is a tiny pixel linked when there is no thumbshot.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
You have two onloads.
Member
Usergroup: Customer
Joined: May 13, 2007
Total Topics: 16
Total Comments: 37
apparently I am dumber than I thought; after many changes this is what I have and it doesn't work:
<img src="http://open.thumbshots.org/image.pxf?url={LINKURL}" onload="if (this.width>50) this.border=1; this.alt='{LINKTITLE} Thumbnails by Thumbshots.org', if (this.width < 50) this.src='/images/noimage-aol.gif'; this.alt='No {LINKTITLE} preview yet'; this width='120' height='90'"> </a>
can someone please tell me exactly when I need to change ? Sorry and thank you again
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Try simplifying:
Member
Usergroup: Customer
Joined: May 13, 2007
Total Topics: 16
Total Comments: 37
would I be pushing my luck to try to get the width='' and height='' for both images? I tried but didn't work so I am not sure if it's even possible. The problem is the classic tag problem that while the image is loaded the page is drawn and once it loads it "moves" as it expands to make room for it.
<img src="http://open.thumbshots.org/image.pxf?url={LINKURL}" alt='{LINKTITLE} Thumbnails by Thumbshots.org' border='1' onload="if (this.width < 50) this.src='/path/wsnlinks/templates/multilingual/images/noimage-aol.gif'">
any suggestions?
Forum Regular
Usergroup: Customer
Joined: May 11, 2003
Total Topics: 64
Total Comments: 199
I realize that this discussion is more than a year old and apparently the thumbshot code (?) has changed since then, because the replacement image from thumbshot unfortunately has the same size as the previews have. Any idea how to replace the image in a different way?
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Thumbshots.org took to using the advertisement replacement image as basically a way to sell people their thumbshots.com service which allows you to set your own replacement image. No way around it without paying them that I can see.
Forum Regular
Usergroup: Customer
Joined: May 11, 2003
Total Topics: 64
Total Comments: 199
"No way around it without paying them that I can see."
Of course, that's what they all do. Exactly the reason why I dropped that other thumb preview service. Ads everywhere...
It just looks stupid when more than half of the thumbs in a category don't really work And I have to figure out how often they refresh those previews - A LOT of them don't even seem to be related to the actual topic of the website. Maybe I have to go back to using the 100x35 buttons after all ...
Thanks, Paul.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
If their replacement image is always the same file size, that info could be used instead of the dimensions. Sources conflict on whether javascript can get that info, though:
bytes.com/groups/javascript...14-reading-image-file-size says it's IE-only
www.ozzu.com/programming-fo...lesize-firefox-t33480.html says it's everything but Firefox
http://www.codingforums.com/showthread.php?t=146127 gives an very complex method that might work in firefox
Forum Regular
Usergroup: Customer
Joined: May 11, 2003
Total Topics: 64
Total Comments: 199
thanks Paul, I'll look into it and let you know