SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ability to generate an image from a web page?

    I'm not sure if this is a PHP question. But I have no idea if or how this might be accomplished. But basically what I'd like to do is to create a page with some specially formatted text on it and from that generate a png (or maybe jpg). And I'd need to be able to set the width and height of the image to generate.

    So basically, load up a web page with your browser set to something like 500x800 and then create a png of it.

    Any ideas what I should look for to do something like this?

    Thanks,

    -David

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,198
    Mentioned
    72 Post(s)
    Tagged
    3 Thread(s)
    Why not use GD or Imagemagick to create the image straight away?
    Imagemagick now has access to Pango if setup with the delegate.
    Pango and imagemagick
    Pango website

  3. #3
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll take a look at that. But basically what the page I want to create an image from will have is a background set with CSS, and some text with special styles applied to it that include font-face and are also sized dynamically with javascript (fitText). So basically I'm trying to create a sort of "work of art" dynamically with CSS and Javascript. And then take a picture of it.

  4. #4
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You could do something like that with imagecreate:

    http://php.net/manual/en/function.imagecreate.php

  5. #5
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,198
    Mentioned
    72 Post(s)
    Tagged
    3 Thread(s)
    I think Imagemagick can do it but you need to use an X server whatever that is!

    Check out the Imagemagick forum - I did find this script but I have not used it: http://www.imagemagick.org/Usage/scr...pshot_webpages

    You would probably need to capture the whole page then crop the part you want.

  6. #6
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I would load the page and use something like Greenshot or another program designed to create images from your monitor screen. You can use the program to highlight the specific part of the screen that you want, eliminating the browser borders, toolbars, etc.
    Each day is a learning experience.


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
  •