WSN PHP Scripts
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?

Details Discussion (13) Print
How to replace empty thumbshot image?
capitaine
Forum Regular
Avatar

Usergroup: Customer
Joined: Aug 05, 2005

Total Topics: 94
Total Posts: 272
quote post #1 - Permalink
Posted 05/14/06 - 3: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=" 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
Avatar

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

Total Topics: 67
Total Posts: 7741
quote post #2 - Permalink
Posted 05/14/06 - 9: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
Avatar

Usergroup: Customer
Joined: Aug 05, 2005

Total Topics: 94
Total Posts: 272
quote post #3 - Permalink
Posted 05/15/06 - 3:37 PM:

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
quote post #4 - Permalink
Posted 05/26/07 - 8: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
Avatar

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

Total Topics: 67
Total Posts: 7741
quote post #5 - Permalink
Posted 05/27/07 - 1:30 AM:

You have two onloads.
2222a
Member

Usergroup: Customer
Joined: May 13, 2007

Total Topics: 16
Total Posts: 37
quote post #6 - Permalink
Posted 05/27/07 - 5: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
Avatar

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

Total Topics: 67
Total Posts: 7741
quote post #7 - Permalink
Posted 05/28/07 - 12:04 AM:

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
quote post #8 - Permalink
Posted 06/13/07 - 7: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
Avatar

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 64
Total Posts: 199
quote post #9 - Permalink
Posted 03/01/09 - 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
Avatar

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

Total Topics: 67
Total Posts: 7741
quote post #10 - Permalink
Posted 03/02/09 - 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
Avatar

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 64
Total Posts: 199
quote post #11 - Permalink
Posted 03/02/09 - 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
Avatar

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

Total Topics: 67
Total Posts: 7741
quote post #12 - Permalink
Posted 03/03/09 - 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:
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
Avatar

Usergroup: Customer
Joined: May 11, 2003

Total Topics: 64
Total Posts: 199
quote post #13 - Permalink
Posted 03/03/09 - 4:41 AM:

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


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