Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Create JPG from html

Posted on 2006-11-12
13
3,126 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Read about why website design really matters in today's demanding market.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This video teaches users how to migrate an existing Wordpress website to a new domain.

840 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