Gossamer Forum
Quote Reply
Quite cool global...
Just thought I would share this new global I just wrote =)

Basically, if you are using the service from Thumbshots.ORG, then you can use this global, to check if an image exists for the current URL ... and if it doesn't, then it will give back the image code, with just the root URL (i.e if an image wasn't found for http://www.gossamer-threads.com/scripts/ , then it would try to see if one existed for http://www.gossamer-threads.com/).

Simply call with <%global_name%> (in link.html, or detailed.html);

Code:
sub {
my $tags = shift;
my $url = $tags->{URL};
use LWP::Simple;
if (get("http://open.thumbshots.org/image.pxf?url=$url")) {
return qq|<img src="http://open.thumbshots.org/image.pxf?url=$url" border="0" onload="if (this.width>50) this.border=1; this.alt='Preview by Thumbshots.org';">|;
} else {
my @cut = split /\//, $url;
my $rooturl = "http://" . $cut[2];
return qq|<img src="http://open.thumbshots.org/image.pxf?url=$rooturl" border="0" onload="if (this.width>50) this.border=1; this.alt='Preview by Thumbshots.org';">|;
}
}

Enjoy Cool

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!