Solved

Create JPG from html

Posted on 2006-11-12
13
3,111 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
Comment Utility
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
Comment Utility
would a cron job help?.. some how??
0
 
LVL 12

Expert Comment

by:UnexplainedWays
Comment Utility
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
 
LVL 2

Accepted Solution

by:
eheimer earned 500 total points
Comment Utility
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
Comment Utility
This may or may not be what you need: maybe you can try services like webshotspro.com or websitescreenshots.com.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Expert Comment

by:InfoStranger
Comment Utility
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
Comment Utility
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
Comment Utility
Ooops...  Thanks.   It was pretty late.
0
 
LVL 2

Expert Comment

by:eheimer
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Read about why website design really matters in today's demanding market.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now