Taking snapshot of a website

Posted on Tuesday, February 17, 2009 by Anuj Mehta

I came across a wonderful web-service called Webthumb for taking snapshot of a website. I created a small Ruby on Rails application for using it. It's a very simple API and my Web App was ready in 10 minutes.

I will be showing here some code of controllers and views. For basics of creating a Ruby on Rails APP refer to my earlier post Ruby on Rails + Netbeans: creating a web App in 10 mins

In this APP I take name of a website from user and then I display it's snapshot.
For initial setup refer to following Readme

Since I want to display the snapshot on my APP I will be using EasyThumb. Below is code of controller that receives the website name and send it EasyThumb. EasyThumb takes a snapshot of the requested website and returns the URL of the snapshot.

def display_sanpshot
name = params[:website_name]
et = EasyThumb.new('YOUR_API_KEY', 'USER_ID')
@image_url = et.build_url(:url => name , :size => :large, :cache => 1)

In the above code image_url contains the URL of snapshot. Below is the View code where I display the snapshot

<title>web thumb</title>
<style type="text/css">
.thumbnail {
position: relative;
.thumbnailMessage {
position: absolute;
top: 0;
left: 0;
width: 200px;
height: 200px;
background: gray;
text-align: center;
<div class="thumbnail">
<img src = "<%= @image_url %>"
title="Generated Thumbnail" width=200 height=200
onload="document.getElementById('tmessage1').style.display = 'none'"
<div class="thumbnailMessage" id="tmessage1">
The image is being generated please wait


Anonymous says:

viѕit vipblogplanet.com to get neω
My webpage ... nulled download