Page 1 of 1

Browser issue with PDF

Posted: 2012-03-01T04:44:13-07:00
by dawson
What I'm trying to do here is to put a image (kind of a stamp) into a PDF.

When I call a PHP that call a shell script from a browser it doesn't work it shows this message:

Code: Select all

convert: Missing Null Image List Separator layers Composite @ mogrify.c/MogrifyImageList/7899.
The command that I run is this:

Code: Select all

convert -density 300 -quality 100 -compress fax -monochrome -alpha off "/opt/lampp/htdocs/pdf/upload/$2" null: /opt/lampp/htdocs/pdf/carimboover.png -gravity $3 -compose multiply -layers composite "/opt/lampp/htdocs/pdf/autenticados/$2" 2>&1
the php code:

Code: Select all

exec("sh /opt/lampp/htdocs/pdf/assinador.sh 2012127444857741000-001 'Flash2.pdf' SouthWest");
If I run this from console It works great, even if I call the PHP file from the console it also works fine, other thing is that if instead of a PDF I send an JPG or PNG file it works fine too.

Re: Browser issue with PDF

Posted: 2012-03-01T15:06:22-07:00
by fmw42
It could be your PHP config? There was a recent problem reported that was probably due to PHP configured in safe mode or something like that. Search the archives an see if you can find that or check your PHP configuration.

Also

try a simple IM command rather than your script.

In PHP all your convert and other such commands within your script probably need to have the full path to them specified.

Re: Browser issue with PDF

Posted: 2012-03-02T10:35:45-07:00
by dawson
Safe mode is off on php.ini

The problem is just converting something from PDF to other thing, if I convert something to PDF it works fine, example:

Works:

Code: Select all

<?php
	echo exec("convert /opt/lampp/htdocs/pdf/upload/example.png /opt/lampp/htdocs/pdf/upload/example.pdf 2>&1");
?>
If I do like this:

Code: Select all

<?php
	echo exec("convert /opt/lampp/htdocs/pdf/upload/example.pdf /opt/lampp/htdocs/pdf/upload/example.png 2>&1");
?>
I get the following error:

Code: Select all

convert: missing an image filename `/opt/lampp/htdocs/pdf/upload/example.png' @ convert.c/ConvertImageCommand/2838.

Re: Browser issue with PDF

Posted: 2012-03-02T10:51:04-07:00
by fmw42
Converting from pdf requires ghostscript (as I understand it). So you need to install the ghostscript delegate and then recompile IM. But PHP also needs to know about ghostscript and that may or may not work automatically.