Webmastersite.net
Register Log In

How to replace empty thumbshot image?

Comments on How to replace empty thumbshot image?

capitaine
Forum Regular

Usergroup: Customer
Joined: Aug 05, 2005

Total Topics: 94
Total Comments: 272
Posted May 14, 2006 - 4:14 PM:

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...

Thanks for any help.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7867
Paul
Posted May 14, 2006 - 10:50 PM:

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 Comments: 272
Posted May 15, 2006 - 4:37 PM:

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'" />
2222a
Member

Usergroup: Customer
Joined: May 13, 2007

Total Topics: 16
Total Comments: 37
2222a
Posted May 26, 2007 - 9:19 AM:

<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
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7867
Paul
Posted May 27, 2007 - 2:30 AM:

You have two onloads.
2222a
Member

Usergroup: Customer
Joined: May 13, 2007

Total Topics: 16
Total Comments: 37
2222a
Posted May 27, 2007 - 6:38 PM:

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
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7867
Paul
Posted May 28, 2007 - 1:04 AM:

Try simplifying:
 <img src="http://open.thumbshots.org/image.pxf?url={LINKURL}" onload="if (this.width < 50) this.src='/images/noimage-aol.gif'"> 
2222a
Member

Usergroup: Customer
Joined: May 13, 2007

Total Topics: 16
Total Comments: 37
2222a
Posted Jun 13, 2007 - 8:23 AM:

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 Comments: 199
Jenny
Posted Mar 01, 2009 - 9:07 AM:

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: 61
Total Comments: 7867
Paul
#10 - Quote - Permalink
Posted Mar 02, 2009 - 2:01 AM:

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 Comments: 199
Jenny
#11 - Quote - Permalink
Posted Mar 02, 2009 - 5:07 AM:

"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
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7867
Paul
#12 - Quote - Permalink
Posted Mar 03, 2009 - 2:25 AM:

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
Jenny
Forum Regular

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 64
Total Comments: 199
Jenny
#13 - Quote - Permalink
Posted Mar 03, 2009 - 4:41 AM:

thanks Paul, I'll look into it and let you know smiling face
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



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