Jump to content

Recommended Posts

When I run test1.pl from terminal it works. When I type the commands directly into terminal they work. When I call the script from php all I get is "hello world".

 

test1.pl:

#!/usr/bin/perl
exec "convert image.pdf image.jpg";
exec "gs -q -sDEVICE=jpeg -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1 -sOutputFile=image.jpg image.pdf 2>&1";
print "hello world";

 

tester.php:

<html>
<head>
<title>pdf to jpg converter</title>
</head>
<body>
<?php
//passthru("convert image.pdg image.jpg");
//passthru("gs -q -sDEVICE=jpeg -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1 -sOutputFile=image.jpg image.pdf 2>&1");
passthru('perl test1.pl');
//$result=passthru("perl test1.pl");
//virtual("perl test1.pl");
?>
</body>
</html>

 

also tried:

<html>
<head>
<title>pdf to jpg converter</title>
</head>
<body>
<?php
$perl = new Perl();
$perl->eval('print "Hello from perl!
"');
print "Bye!
";
?>
</body>
</html>

 

which produced this error:

Fatal error: Class 'Perl' not found in /Library/Tenon/WebServer/WebSites/www.ABCAdvertising.net/beta_web/beta_apps/test/tester.php on line 12

...ummmm...I don't know.

 

All I'm really trying to do is convert a pdf to a jpg with imagemagick and ghostcript.

 

Flow chart:

user selects pdf

imagemagick and ghostscript convert pdf to jpg, page redirects to new page

newley created jpg is placed on the new page for display

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.