Question

I am working on a Ruby on Rails app that visualizes product trees. The tree is built of nodes an everything is rendered in HTML/CSS3. Some of the products make several hundred SQL queries as the tree builds up (up to 800 queries on the biggest tree).

I'd like to have small thumbnails of each tree to present it on an index page. So rendering each tree once again and modifying CSS to make a tiny representation is an option.

But i think it's probably easier to generate thumbnails, crop, cache, and show these on the index page.

Any ideas on how to do this? Any links/articles/blog posts that could help me?

Was it helpful?

Solution 3

This question has been open for quite a while. I have a proposal which actually fulfills most of the requirements.

Webkit2png can create screenshots which and crop parts of the image. You can specify dimensions, crop areas, and also it provides a thumbnail of the pages.

However, it will not support login in your application out-of-the-box.

Webkit2png is really easy to use in a shell script, so you can just feed it with a number of URLS and it will return all the image files.

More info in this blog post: Batch Screenshots with webkit2png

Webkit2png has an open request to add authentication (so you can use it on logged in pages).

OTHER TIPS

Check out websnapr; it looks like they provide 100,000 free snaps a month.

I should check this site more often. :D Anyway, I've done some more research and it looks like you'll need to set up some server-side scripts that will open a browser to the page, take a screenshot, and dump the file/store in database/etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top