Essentials:

Make your own Snap.com thumbnails

In this article I will describe the process of getting the perfect thumbnail for your website on Snap.com. Using some simple PHP code you can put this little script to work for you!

I saw a neat little website add-on a while ago and put it on a list of things to get back to. It is a product from Snap.com (hover your cursor over the Snap.com link to see it.) which is a search engine that will show you an image of the website your search query returns. Pretty slick with a fair amount of novelty and oddly I found that if the little preview image looked ‘cool’ that I was more likely to click on it and I completely ignored the description and relevancy of the search result.

I would like to say at this point that I haven’t looked around at any other articles that others have written about this topic so I don’t know if this is redundant information for all of you or if it’s even going to be interesting.

The shiny goodness…

So, I checked out how the service works and signed up for use with Pinwire.com. After inserting the code they generated just above the < /HEAD > tag as requested I began to make some interesting observations.

When you hover over an off site link that hasn’t been visited before by Snap you will see a pop-in message stating Snap is capturing the preview image now. After a few seconds if your hover your mouse over the link again you will see the newly created thumbnail.

So it occurred to me that not all site thumbnails are the same proportions. For example if you have only a small amount of text on a page the thumbnail will show you ‘close up’ of that text in an attempt to fill the thumbnail with content. If you have a large page with allot of content the thumbnail will only show a portion of the entire page.

I haven’t figured out yet if it only grabs a 640×480 size window or if it grabs a larger resolution and then scales it down. My suspicion is that it is only grabbing a 640×480 or so resolution image.

Another observation that I made was that when I hovered over an offsite link that the access logs for the offsite website showed 2 hits for every thumbnail generation request. The first is from a block of changing IP addresses and immediately after that a hit from Google. Below are 2 examples of what the access logs reported when I hovered over a link that had no previous thumbnail made.

38.98.19.83 www.domain.com – – [30/Dec/2006:18:18:25 -0800] “GET /details0.php HTTP/1.1” 200 18885 “-” “Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7”

crawl-66-249-72-68.googlebot.com www.domain.com – – [30/Dec/2006:18:18:26 -0800] “GET /details0.php HTTP/1.1” 200 18839 “-” “Mediapartners-Google/2.1

38.98.19.72 www.domain.com – – [30/Dec/2006:18:19:11 -0800] “GET /details1.php HTTP/1.1” 200 18741 “-” “Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7”

crawl-66-249-72-68.googlebot.com www.domain.com – – [30/Dec/2006:18:19:12 -0800] “GET /details1.php HTTP/1.1” 200 18762 “-” “Mediapartners-Google/2.1”

From this I have made some guesses as to what is going on.

A. Snap.com sends the link info to Google and they process the image and store the thumbnail.
B. Snap.com generates the thumbnail sends it to Google for caching and then Google spastically visits the target site.
C. Spap.com is a Google project.
D. Is this a way to get Google to crawl my site more quickly?
E. I’ll never know and should just finish this article.

I don’t mind that Google is somehow involved with this process I just would like to know what it is that they are doing by crawling my site just after the Snap.com request come’s in.

So how can I have fun with this?

After playing around with making 10 or so thumbnails I realized that I didn’t like the way the content was being captured and cropped into a thumbnail. So I came up with a bit of PHP code that would allow me to control what Snap.com was grabbing to make a snapshot.

Firstly I wanted to find a way to check who is visiting the website and then if their IP address matches one that I have isolated as a Snap.com IP then show them some other content.

Fortunately this can be done and inserted into your website easily.

How to falsify the thumbnail of your website for Snap.com

Here is the PHP code that does the work:

‹ ?
// $snapsite = $REMOTE_ADDR; // IP address of remote client
$snapsite= getenv('REMOTE_ADDR'); // IP address of remote client alternative
$ip= "38.98.19"; // Best guess IP address from Snap.com

// Trim the IP of the remote client IP
// Example use: substr('abcdef', 1, 3);  // result is: bcd
$snap= substr($snapsite, 0,8); // keep first 8 characters

if($snap== $ip)
{
/* Here we define the snap page
and then grab the current url of the
site and redirect snap to the page we
want to have shown in the thumbnail. */
$myfile= "snap.php";
$host= $_SERVER['HTTP_HOST'];
$uri= rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra= 'snap.php';
// Assemble the variables into a new URL
// header("Location: http://$host$uri/$extra"); // Alternative
header("Location: http://www.website.com/snap.php");
}
?›


I then made a simple page called snap.php and designed it graphically so that when Snap.com generates the thumbnail the results are simple and clean.

Then you simply place the PHP code from above into the top of your website template page or at the top of any PHP pages that you want to falsify a Snap.com thumbnail for.

Now when Snap.com visits your website it will be directed to a custom page and generate a perfectly formated thumbnail.

The result looks like this:

The interesting thing about this is that you get a visit from Snap.com you could actually direct them to a completely different website and Snap.com would show that other website thumbnail as your website thumbnail.

Enjoy.

 

No comments yet.

Add a comment

Pinwire @ tumblr

    http://pinwirecom.tumblr.com/post/99399753457http://pinwirecom.tumblr.com/post/99056819727http://pinwirecom.tumblr.com/post/98488475777http://pinwirecom.tumblr.com/post/94745420282http://pinwirecom.tumblr.com/post/92737496842http://pinwirecom.tumblr.com/post/88505613492