SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML to image on Linux

    Hello,

    I am working with a development team, and we need to be able to generate JPG / PDF output from layered HTML at the size of 2048 x 1536. We would like it to be able to be output at several different sizes for diffferent usages (ie, thumbnail, mobile, print) - the team found this :

    http://www.guangmingsoft.net/htmlsna...html2image.htm

    They are having a hard time getting it to run on our Red Hat server; is there anything which might get this job done that would run on Red Hat, and doesn't cost $300 ? I am not a PHP coder, but it seems like this functionality should not be dependent on the specific distro of Linux.

    Any PHP coders out there with any advice would be most warmly appreciated.

    Thanks,
    Colin

  2. #2
    SitePoint Guru bronze trophy TomB's Avatar
    Join Date
    Oct 2005
    Location
    Milton Keynes, UK
    Posts
    988
    Mentioned
    9 Post(s)
    Tagged
    2 Thread(s)
    Provided it's running X server you should just be able to do

    PHP Code:
    exec('firefox -savepng http://www.whatever.com/'); 
    obviously you'll need to install firefox too.

  3. #3
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by TomB View Post
    Provided it's running X server you should just be able to do

    PHP Code:
    exec('firefox -savepng http://www.whatever.com/'); 
    obviously you'll need to install firefox too.

    Tom, have you got any links for that functionality? Seems pretty interesting!
    I tried Google, but didn't have much luck finding any (official) docs about this...

  4. #4
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    From what I read, you need the Pearl Crescent Page Saver extension to use the -savepng option.

    Have you looked at wkhtmltopdf ?
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  5. #5
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Immerse View Post
    Tom, have you got any links for that functionality? Seems pretty interesting!
    I tried Google, but didn't have much luck finding any (official) docs about this...
    Search for Firefox and Xvfb. Will give you some hits.

    The problem is that you need a full X server running to do this. It's fairly heavy weight.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •