Solved

Create JPG from html

Posted on 2006-11-12
13
3,121 Views
Last Modified: 2008-01-09
Hi,
I am after a script that will convert a webpage into a jpg.  I need it to be an online script, preferably to be run by PHP, and write the file to a directory.
If some one could give a specific and detailed way how i would be most appreciative!

Many thanks!
Pauliostro
0
Comment
Question by:Pauliostro
  • 3
  • 2
  • 2
  • +3
13 Comments
 
LVL 10

Expert Comment

by:aplimedia
ID: 17924840
Not sure you will be able to do that. The fact is that the JPG is created from the Browser, like a screen shot. The server serves code to a browser which then displays the data as a web page. There is no browser on the server... the JPG you get is a function - plugin -program which runs clientside... on the users machine, and the not the server.

Aplimedia
0
 

Author Comment

by:Pauliostro
ID: 17924854
would a cron job help?.. some how??
0
 
LVL 12

Expert Comment

by:UnexplainedWays
ID: 17924952
http://andy.5263.org/screengrab/

Or you can go to the FF Extentions and look for it on there website.  However reading there webpage it likes older versions of FF (pre 2 release).

0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 2

Accepted Solution

by:
eheimer earned 500 total points
ID: 17924966
I was able to find this Perl script for free: http://user.it.uu.se/~jan/html2ps.html which converts html to Postscript.

There is also this: http://www.guangmingsoft.net/htmlsnapshot/html2image.htm which converts html to bmp, png, and jpg.  It is free to try, $300 to buy.

The second one might be your beswt bet.  It looks like the first one would require a second step to convert the ps into jpg.
0
 
LVL 6

Expert Comment

by:aescnt
ID: 17925573
This may or may not be what you need: maybe you can try services like webshotspro.com or websitescreenshots.com.
0
 
LVL 3

Expert Comment

by:InfoStranger
ID: 17928366
Here is the codes for converting a file or url to jpg.

http://www.php.net/manual/en/function.imagecreatefromjpeg.php

When running the code, you need to following enclosed in <?php    ?>.
LoadJpeg(\...\???.html)
LoadJpeg(http://.../???.html)

Or something to that nature.  I don't know what you are converting.
0
 
LVL 2

Expert Comment

by:eheimer
ID: 17933691
InfoStranger,

imagecreatefromjpeg creates an image from another image.  Although the documentation says "imagecreatefromjpeg -- Create a new image from file or URL", the URL must point to a jpg file, not an html document.
0
 
LVL 3

Expert Comment

by:InfoStranger
ID: 17934558
Ooops...  Thanks.   It was pretty late.
0
 
LVL 2

Expert Comment

by:eheimer
ID: 18155896
Well, I'll plead my case for the sole recipient (no offense to the other experts).  The question clearly asked for a script such as PHP which is presumeably to be run server-side.  My answer is the only one that conformed to that requirement.
0
 
LVL 6

Expert Comment

by:aescnt
ID: 18156407
I've no objections to eheimer's plea. InfoStranger's suggestion was off (it was about loading a jpeg file for use in PHP), UnexplainedWays's suggestion was a Firefox extension, and mine was admitedly not a solution but more of a tip.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read about why website design really matters in today's demanding market.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question