|
From: happysailingdude on 24 Apr 2008 11:24 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.
From: Ian Skinner on 24 Apr 2008 11:35 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.
From: Azadi on 24 Apr 2008 12:08 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/
From: Mr Black on 24 Apr 2008 15:41 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.
|
Pages: 1 Prev: CFinput and autosuggest difficulty Next: passing multiple parms in autosuggest |