Skip to main content
January 30, 2010
Question

Web site Thumbnail

  • January 30, 2010
  • 2 replies
  • 1566 views

Hello,

I am trying to have a function on my site to be able to generate a web site screenshot, but i am running into a problem.

I found a bunch of online services that provide you with generating the screenshot but they only give you access to the screenshot via a url. I wanted to be able to download the image and save it on my server so i don't have to re-generate it everytime, does anyone have any ideas on how to accomplish this?

An example of what the url would look like is this:

http://images.websnapr.com/?size=500&key=16yhsfvefrdotwC&url=www.google.com

And that would just redirect you to the image that it generates in jpg format.

Thank you.

    This topic has been closed for replies.

    2 replies

    existdissolve
    Inspiring
    January 30, 2010

    MM--

    Adam's right--using cfhttp to accomplish this is the way to go...then you can use <cfimage> and related functions to crop, resize, etc. As he suggested, though, you'll want to make sure that it's something allowable by the service's TaC.

    It might be worth it to try doing this yourself, if you have access to your server.  I've written up a post of how to accomplish this using a freely-available screenshot generating executable called IECapt.

    Check out this post for detailed instructions:

    http://singularityconcepts.com/blog.cfm?postID=75

    Hope this helps!

    Joel

    February 2, 2010

    Yo, AWESOME tutorial, that was exactly what i was looking for thnx.... Even though im using linux, i figured out how to get it to work on it and it works great.... But i have a question about scripting it, i am trying to get it to run using cfexecute but i can't get it to work, am i doing something wrong here?

    <cfexecute name="xvfb-run --server-args='-screen 0, 1024x768x24' ./root/cutycapt/CutyCapt --url=http://www.google.com --out=/var/www/www.test.com/images/google.jpg" timeout="100"/>

    Everytime i try to run it i get the following error, but i can't figure out why...

    The cause of this exception was that: java.io.IOException: Cannot run program "xvfb-run --server-args='-screen 0, 1024x768x24' ./root/cutycapt/CutyCapt --url=http://www.google.com --out=/var/www/www.test.com/images/google.jpg": java.io.IOException: error=2, No such file or directory.

    Inspiring
    February 2, 2010

    You might want to review the usage of <cfexecute>: http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_d-e_18.html#1098198

    You might be putting more info in the NAME attribute than is appropriate.

    --

    Adam

    Inspiring
    January 30, 2010

    Can't you just <cfhttp> the image that URL returns and save it locally?

    Best you check the Ts&Cs of the websnapr service before doing that, though.

    --

    Adam