Please note: This thread was created a long time ago (05/14/06 - 3:14 PM), so the information or advice in it may not be appropriate anymore due to the many changes in the script since that time. Please ask to verify if this thread still applies, or start a new thread.
How to replace empty thumbshot image?
|
capitaine
Forum Regular Usergroup: Customer Joined: Aug 05, 2005 Total Topics: 94 Total Posts: 272 |
#1 - Permalink
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=" 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... Thanks for any help. Truth don die |
|
Paul
developer Usergroup: Administrator Joined: Dec 20, 2001 Location: Diamond Springs, California Total Topics: 67 Total Posts: 7741 |
#2 - Permalink
Does thumbshots offer some way for you to get a value stating that the image is or isn't available? |
|
capitaine
Forum Regular Usergroup: Customer Joined: Aug 05, 2005 Total Topics: 94 Total Posts: 272 |
#3 - Permalink
ok this is the way to do it, for the benefit of anyone else using this feature: <img src="http://www.webmastersite.net/forums/thumsbhots code here" onload="if (this.width < 50) this.src='URL to alternate image'" /> Truth don die |
|
2222a
Member Usergroup: Customer Joined: May 13, 2007 Total Topics: 16 Total Posts: 37 |
#4 - Permalink
<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.
|
|
Paul
developer Usergroup: Administrator Joined: Dec 20, 2001 Location: Diamond Springs, California Total Topics: 67 Total Posts: 7741 |
#5 - Permalink
You have two onloads. |
|
2222a
Member Usergroup: Customer Joined: May 13, 2007 Total Topics: 16 Total Posts: 37 |
#6 - Permalink
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 |
|
Paul
developer Usergroup: Administrator Joined: Dec 20, 2001 Location: Diamond Springs, California Total Topics: 67 Total Posts: 7741 |
#7 - Permalink
Try simplifying: <img src="http://open.thumbshots.org/image.pxf?url=" onload="if (this.width < 50) this.src='/images/noimage-aol.gif'"> |
|
2222a
Member Usergroup: Customer Joined: May 13, 2007 Total Topics: 16 Total Posts: 37 |
#8 - Permalink
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? |
|
Jenny
Forum Regular Usergroup: Customer Joined: May 11, 2003 Total Topics: 64 Total Posts: 199 |
#9 - Permalink
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? |
|
Paul
developer Usergroup: Administrator Joined: Dec 20, 2001 Location: Diamond Springs, California Total Topics: 67 Total Posts: 7741 |
#10 - Permalink
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. |
|
Jenny
Forum Regular Usergroup: Customer Joined: May 11, 2003 Total Topics: 64 Total Posts: 199 |
#11 - Permalink
"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. |
|
Paul
developer Usergroup: Administrator Joined: Dec 20, 2001 Location: Diamond Springs, California Total Topics: 67 Total Posts: 7741 |
#12 - Permalink
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: http://bytes.com/groups/javascript/149814-reading-image-file-size says it's IE-only http://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 Edited by Paul on 03/03/09 - 2:37 AM |
|
Jenny
Forum Regular Usergroup: Customer Joined: May 11, 2003 Total Topics: 64 Total Posts: 199 |
#13 - Permalink
thanks Paul, I'll look into it and let you know
|
| |
||
|
||
This thread is closed, so you cannot post a reply.





? It works fine when there is a thumsbhot, but all I see is a tiny pixel linked when there is no thumbshot.
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 ...