Skip to content

ami-navon/python-thumbnail-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

python-thumbnail-server

A minimal python webserver that easily generates webpage thumbnails. The server makes use of Python, Python Twisted and webkit to render the webpage thumbnails.

Usage

To start up the webserver in headless mode:

$ xvfb-run --server-args="-screen 0, 1280x768x24" $PWD/webserver_thumbnails.py 

To start up the webserver in non-headless mode:

$ python webserver_thumbnails.py

The program accepts the following command line flags;
—port: Port to listen on (default: 8080)
—width : Default thumbnail width (default: 640)
—height : Default thumbnail height (default: 480)

For example,

$ python webserver_thumbnails.py --port 8000 --width 320 --height 200

Testing using HTTP GET via curl:

$ curl -O out.png “http://localhost:8080?url=http://www.cnn.com”

To use using HTTP POST:

$ curl -O out.png -X POST -F ‘url=http://politicalticker.blogs.cnn.com/2010/12/07/live-blog-president-obamas-news-conference/’ “http://localhost:8080”

Set thumbnail width and height in the url:

$ curl -O out.png “http://localhost:8080?width=320&height=240&url=http://www.cnn.com”

Installation

To Install on Ubuntu (tested on Ubuntu Desktop or Sever 10.x):

sudo aptitude install xvfb xfonts-base xfonts-75dpi xfonts-100dpi imagemagick ttf-mscorefonts-installer python-qt4 python-qt4 python-pip build-essential python-setuptools flashplugin-installer

sudo pip install -U twisted

Acknowledgments

This library depends heavily on the great python-webkit2png gem by Adam Nelson and Roland Tapken at: “http://www.blogs.uni-osnabrueck.de/rotapken/2008/12/03/create-screenshots-of-a-web-page-using-python-and-qtwebkit/”.

About

Minimal Python Thumbnail-Snapshot server, based on python-webkit2png and twisted

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages