LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-10-2012, 03:15 PM   #1
conflicker
Member
 
Registered: Sep 2011
Posts: 92

Rep: Reputation: Disabled
PHP html to image


Hi, I've been looking a script or library that allow me to convert html to image, I came up with the GD image but not yet sure and also with wkhtmltoimage that can be installed in the server to make it work.

I just want to get an idea for a better way of converting html to image.

Thank you for your ideas.
 
Old 08-10-2012, 04:11 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
HTML describes how a web browser should render a page. Whatever you come up with is going to have to have all of the functionality of a web browser, as well as the ability to render to an image file. You might be able to use GD as the final rendering engine, but there will be a lot of processing of data in between, such as rendering fonts, fetching inline images, handling javascript, possibly Java Applets, interpreting CSS, and probably other stuff I haven't though of.
It will probably be easier to craft some kind of script that launches an existing browser, and uses X-based tools to capture the browser window content to an image file. That, too, will have problems, unless you only capture pages that can be rendered within the dimensions of your X server. Perhaps a virtual X server, such as Xvfb can help with that.
A few standard applications that could get the process started: xwininfo, xlsclients, xwd, the ImageMagik collection, and the aforementioned Xvfb.

--- rod.
 
Old 08-10-2012, 04:22 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,217

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
You might consider using PhantomJS.

http://code.google.com/p/phantomjs/wiki/QuickStart

Scroll down to "rendering"

Last edited by dugan; 08-10-2012 at 05:12 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP: how can I return an image - not the html img src tag, but the image data BrianK Programming 3 05-18-2007 02:28 PM
php image blob managing cannot get image from html ilpadrino Programming 6 04-15-2007 09:05 AM
Apache rending php when filename is x.php.html mastahnke Linux - Server 6 01-22-2007 08:39 AM
html image load ygloo Programming 3 09-16-2006 01:04 PM
HTML & Image rickycen Linux - General 8 08-15-2005 12:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration