WebmasterSite.net

Register | Forgot Password

How to replace empty thumbshot image?

Version: 3.3.17
printPrint
locked


How to replace empty thumbshot image?
capitaine
Forum Regular
Avatar

Usergroup: Customer
Joined: Aug 05, 2005

Total Topics: 94
Total Posts: 273
Posted 05/14/06 - 03:14 PM:
quote post
#1
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
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California

Total Topics: 64
Total Posts: 7217
Posted 05/14/06 - 09:50 PM:
quote post
#2
Does thumbshots offer some way for you to get a value stating that the image is or isn't available?

"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founder of Red Hat
capitaine
Forum Regular
Avatar

Usergroup: Customer
Joined: Aug 05, 2005

Total Topics: 94
Total Posts: 273
Posted 05/15/06 - 03:37 PM:
quote post
#3
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
Posted 05/26/07 - 08:19 AM:
quote post
#4
<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 smiling face? It works fine when there is a thumsbhot, but all I see is a tiny pixel linked when there is no thumbshot.
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California

Total Topics: 64
Total Posts: 7217
Posted 05/27/07 - 01:30 AM:
quote post
#5
You have two onloads.

"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founder of Red Hat
2222a
Member

Usergroup: Customer
Joined: May 13, 2007

Total Topics: 16
Total Posts: 37
Posted 05/27/07 - 05:38 PM:
quote post
#6
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 smiling face? Sorry and thank you again
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California

Total Topics: 64
Total Posts: 7217
Posted 05/28/07 - 12:04 AM:
quote post
#7
Try simplifying:
 <img src="http://open.thumbshots.org/image.pxf?url=" onload="if (this.width < 50) this.src='/images/noimage-aol.gif'"> 

"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founder of Red Hat
2222a
Member

Usergroup: Customer
Joined: May 13, 2007

Total Topics: 16
Total Posts: 37
Posted 06/13/07 - 07:23 AM:
quote post
#8
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
Avatar

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 62
Total Posts: 195
Posted 03/01/09 - 09:07 AM:
quote post
#9
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
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California

Total Topics: 64
Total Posts: 7217
Posted 03/02/09 - 02:01 AM:
quote post
#10
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.

"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founder of Red Hat
Jenny
Forum Regular
Avatar

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 62
Total Posts: 195
Posted 03/02/09 - 05:07 AM:
quote post
#11
"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 sad 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
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California

Total Topics: 64
Total Posts: 7217
Posted 03/03/09 - 02:25 AM:
quote post
#12
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 - 02:37 AM

"Do things you love doing, because then it ain't work. Don't do something you don't really enjoy, because you're never going to work hard enough at it." - Bob Young, founder of Red Hat
Jenny
Forum Regular
Avatar

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 62
Total Posts: 195
Posted 03/03/09 - 04:41 AM:
quote post
#13
thanks Paul, I'll look into it and let you know smiling face
Search thread for
Download thread as
locked


This thread is closed, so you cannot post a reply.

WSN Links WSN Gallery WSN Knowledge Base WSN Forum WSN Classifieds WSN Directory WSN Software Directory