Page 1 of 1
perl equivalent to "convert image.pdf image.jpg"
Posted: 2007-08-23T07:29:09-07:00
by matthewst
I can't make imagemagick work in php so maybe perl can do it?
Re: perl equivalent to "convert image.pdf image.jpg"
Posted: 2007-08-23T10:13:45-07:00
by Bonzo
You will need to look at Perlmagick - I know nothing about it but it needs some Perl code installed on the server.
There is a PerlMagick section on the forum along with some examples here
http://www.imagemagick.org/script/perl-magick.php
It is probably similar to MagickWand ?
Re: perl equivalent to "convert image.pdf image.jpg"
Posted: 2007-08-23T10:20:07-07:00
by matthewst
Heres the funny thing, I can run the following script from the web but it still won't convert but it does display "hello world".
test1.pl
Code: Select all
#!/usr/bin/perl
exec "convert image.pdf image.jpg";
print "hello world";
If I'm on the server I can type "perl test1.pl" and it will do what I want it to do.
Re: perl equivalent to "convert image.pdf image.jpg"
Posted: 2007-08-23T10:26:24-07:00
by Bonzo
If you look on the index page of my site near the bottom I have some Perl scripts and there outputs I have "borrowed" from other sites. See if they work?
It does not work like php you need to use an API ?
Re: perl equivalent to "convert image.pdf image.jpg"
Posted: 2007-08-23T11:21:31-07:00
by matthewst
whats an api?
Re: perl equivalent to "convert image.pdf image.jpg"
Posted: 2007-08-23T11:44:22-07:00
by Bonzo
API = Application programming interface (
http://en.wikipedia.org/wiki/Applicatio ... _interface )
I think basicly its another language to run the first language and supposedly simplify it
From what I understand MagicWand, PerlMagic are API's along with things like the one used to produce googlemaps.
Re: perl equivalent to "convert image.pdf image.jpg"
Posted: 2007-08-23T17:30:51-07:00
by ridera
I've started using Imagick, a new PHP native extension.
CardinalRules.pdf just happened to be a pdf I had handy. Obviously, it has to be in the same directory, or you must include the full path. AND, the dir must have write permissions if you use the write file version.
This works if you need other html stuff on the page:
Code: Select all
$report= "<html><body>\n\n";
$obj = new Imagick('CardinalRules.pdf');
$obj->SetImageFormat('jpeg');
$obj->writeImage('CardinalRules.jpg');
$report .= "<img alt=\"image missing\" src=\"./CardinalRules.jpg\">\n\n";
$report .= "</body></html>\n\n";
echo $report;
Alternatively, you can send the jpg to the client and not make a file.
Code: Select all
header('Content-type: image/jpeg');
$obj = new Imagick('CardinalRules.pdf');
$obj->SetImageFormat('jpeg');
echo $obj;
Re: perl equivalent to "convert image.pdf image.jpg"
Posted: 2007-08-24T22:00:15-07:00
by anthony
For basic command line OR API tests in PHP see..
http://www.imagemagick.org/Usage/api/#php
This is always a good place to start for any new Web server, so you can find out what is and is not installed and working on that web server. Especially when you did not install it and don't have system level access.
They are also good tests to use in reports to ISP's to get them to fix there web server, and not so complex it takes a lot to know what they are doing.