Link to home
Start Free TrialLog in
Avatar of Pauliostro
Pauliostro

asked on

Create JPG from html

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
Avatar of aplimedia
aplimedia
Flag of Spain image

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
Avatar of Pauliostro
Pauliostro

ASKER

would a cron job help?.. some how??
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).

ASKER CERTIFIED SOLUTION
Avatar of eheimer
eheimer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This may or may not be what you need: maybe you can try services like webshotspro.com or websitescreenshots.com.
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.
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.
Ooops...  Thanks.   It was pretty late.
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.
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.