surampudi ravi teja
surampudi ravi teja

Reputation: 21

How do we create thumbnails of pages in CQ5?

CQ5 allows us to create different renditions of images so that we can use them for multiple purposes, the main one being thumbnails.

Based on the same use case, Can we dynamically create a thumbnail for a page in CQ5?

So if a user searches for a page in my website, i would want to display a snapshot of the page as a part of the result and when clicked the user goes to see the main page.

Please note that I do not want to use the thumbnail property of a template, as it displays the same image, nor would i want to retrieve the image stored in page properties.

So is there a way we can achieve this??

Thanks, Ravi

Upvotes: 2

Views: 1440

Answers (1)

Arth Du
Arth Du

Reputation: 807

This is a pretty tough question to answer entirely. My initial reaction is to tell you to create a new page property for each page for the thumbnail and use that. This is done easily by modifying the dialog node for your page template. You would have to take a screenshot of every page you wanted to list and upload it to that page's properties, but it would certainly get the job done.

However, it sounds like you want your screenshot to be dynamically generated and that's a little outside the scope of CQ. You're going to need a graphics software library to do that. Luckily there are several open source options. The one I'm most familiar with is Cairo (http://en.wikipedia.org/wiki/Cairo_%28graphics%29)

Firefox uses Cairo as part of its rendering engine (Gecko). Essentially, what you'd need to do is have the output of the rendering engine go to a file (like a png) instead of displaying in your browser. This is similar to what Google does when you can preview search results in the right pane of the page. Basically, their crawler takes screengrabs (I assume using this method) and then when you search, they already have the page captured.

I also came across this write-up (http://jerel.co/blog/2010/10/using-firefox-on-a-headless-server-to-make-screenshots-of-websites) on using Firefox to take screenshots of websites.

Whichever path you choose, I wish you the best. Sounds like an ambitious project.

Upvotes: 1

Related Questions