Thumbnails of HTML pages

I saw that Raymond Camden posted an example for this in June, and I decided to play with it a little. I am working on a project that needs to grab html files and display thumbs, and I modified the code some and dumped it in a CFC. What I am doing, in a nutshell, is cfhttping to a supplied url and resolving the urls. From there I am stripping the javascript and changing the tags for css files to css @import. I found that if you don’t do this, the css will not render the page correctly. After that, I create a pdf out of the file and then convert it to an image. Everything is great until the image conversion, at which point all the images get a border on the right and bottom. I have no idea what is causing this, but maybe someone out there knows. Anyone know?
Oh yeah, here is the code in case anyone wants to use it: Code is here
I don’t see a border on the image above…
The image as a whole doesn’t have a border, it’s the individual images in the page. You can tell by the way the background image of the page tiles. the actual background image is just a small square that is repeating. Each square is given a right and bottom border, as well as every other image on the page.
Hi Lu -
this looks really interesting… I am thinking it’d be perfect in a directory site I’m working on … add a url and get the thumbnail of the page made dynamically – is that right?
That’s right, all you have to do is pass in the url and the code will generate a pdf of the document and then convert it to thumbnails. I am still trying to figure out why the black border appears on the individual images in the image itself. It occurs when the cfpdf thumbnail conversion kicks off. As soon as I get a solution I will post up the updated code and will probably post it up on RIAForge.com.
I’m rather annoyed with the whole cfhttp/pdf solution. We talked about this during the alpha/beta of Scorpio and Damon/Tom J./Sean was like, “Bah, it’s good enough.” Anyway, forget all that. If you’re on windows server, you can use this ( http://www.websitescreenshots.com/ ) – Yes, unfortunately, the “full” version with the command line costs money. It works though and does everything as advertised.
Screenshot programs are nice and all, but I can easier capture the page with a screenshot and photoshop it down to size. I was trying to find an open source and programmatic method of producing the screenshots. So you have any suggestions on how to produce better quality snapshots via CF?