• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

taking screengrabs of sites in CF

Participant ,
Apr 24, 2008 Apr 24, 2008

Copy link to clipboard

Copied

hi - here's a good one for you..

we want to be able to take a screengrab of a site's index page and save it as jpg (we have a list of 1000 sites we want to do this for)

i'm thinking that it can probably be done using cfhttp and then outputting the obtainted html within cfdocument tags to create a jpg of the page

then we could use cfimage to reduce the size of that resulting image to 400px wide

before i spend the next 10-20 hours barking up the wrong tree with this; does anyone have any comments / suggestions / heads up's to make?

anyone done this before, ran into any problems? got an easier route to suggest?

thanks very much indeed.
TOPICS
Advanced techniques

Views

502

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 24, 2008 Apr 24, 2008

Copy link to clipboard

Copied

happysailingdude wrote:
> outputting the
> obtainted html within cfdocument tags to create a jpg of the page

This section is outside of CF abilities. Where are you outputting the
HTML? ColdFusion is not a browser, it won't render the HTML.

You would need some tool that renders the HTML and creates the JPG for
you. I do not know what this might be, but I am sure it is out there
somewhere.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 24, 2008 Apr 24, 2008

Copy link to clipboard

Copied

it is in fact extremely easy to do in CF8. here's a working proof:
[warning: a dir "thumbnails" will be created if it does not exist OR
DELETED AND RE-CREATED IF IT DOES in the executed template's folder. the
it is the cfpdf's doings, not mine...]

<!--- --->
getting url... <cfflush>
<cfhttp url=" http://www.sabai-dee.com" resolveurl="yes" result="myres">
... got it!<br>
creating in-memory pdf... <cfflush>
<cfdocument format="pdf" name="mypdf">
<cfoutput>#myres.filecontent#</cfoutput>
</cfdocument>
...pdf created!<br>
generating thumbnail... <cfflush>
<cfpdf action="thumbnail" source="mypdf" overwrite="yes">
...done!<br><br>
here it is:<br><br>
<img src="thumbnails/thumbnail_page_1.jpg"><br><br>
<a href=" http://www.sabai-dee.com" target="sdc">compare to original</a>
<!--- --->

there are numerous other settings one can employ in all the above-used
cf tags to control size, quality and other aspects of the generated
jpeg. and if you throw <cfimage> into the mix, the capabilities are
pretty much limitless...

hth


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 24, 2008 Apr 24, 2008

Copy link to clipboard

Copied

Cool. Works OK for basic and simple HTMLs. However, when I try "www.yahoo.com", I get garbage. Flash, complex page structure, etc. Dont' forget to use useragent for IE or some other advanced browser, otherwise you will get plain HTML. I used:
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1)"

There is a real solution: http://www.cftagstore.com/tags/cfxwebthumb.cfm.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 27, 2008 Apr 27, 2008

Copy link to clipboard

Copied

I agree with Mr Black. The weak link in the chain is cfdocument. It is not yet capable of reproducing an arbitrary website display as we see it in the browser.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 30, 2008 Apr 30, 2008

Copy link to clipboard

Copied

just stumbled upon this:
http://stylizedweb.com/2008/04/26/website-screenshots-services/

the last entry, a web service, looks interesting....
haven't tried it yet, though...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2008 Apr 30, 2008

Copy link to clipboard

Copied

LATEST
Good find, Azadi.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation