Page 1 of 1

Error codes

Posted: 2016-09-28T12:02:21-07:00
by fabrice4821
Hi,

I'm using imagemagick in my php code to convert PDF file in JPG pictures.

I'm using :

Code: Select all

exec('convert -density 300 -trim "'.$pdf_file.'" -quality 80 -resize 800 "'.$save_to.'"', $output, $return_var);
Some times, in the return_var I have the error number 9 or 1.

What are this errors ?

Best regard.

Re: Error codes

Posted: 2016-09-28T15:25:00-07:00
by fmw42
I do not know. They sound like unix numbers. I believe IM only shows 0 or 1.

You should put your -trim after reading the PDF file and include +repage, for proper IM 6 or 7 syntax.

Please always provide your IM version and platform when asking questions, since syntax may differ.

If you want to see actual error messsages then change your command to

Code: Select all

<?php
exec('convert -density 300 "'.$pdf_file.'" -trim +repage -resize 800 -quality 80  "'.$save_to.'"' 2>&1, $output, $return_var);
foreach($output as $text)
{echo "$text<br>";}
?>
You do not say what the output image format is? If JPG then -quality is OK. But if some other format such as PNG, then -quality values are totally different. See http://www.imagemagick.org/script/comma ... hp#quality

Re: Error codes

Posted: 2016-10-03T08:39:33-07:00
by fabrice4821
Hi,

The output image format is jpg.

When I have the error 9 in $return_var, there are not information in $output

When I have the error 1 in $return_var, there are in $output:
Error: /ioerror in --showpage--
Operand stack:
1 true
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop --nostringval-- --nostringval-- 3 1 40 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- 1761 0 9 %oparray_pop --nostringval-- --nostringval--
Dictionary stack:
--dict:1162/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75/200(L)-- --dict:108/127(ro)(G)-- --dict:290/300(ro)(G)-- --dict:22/25(L)-- --dict:6/8(L)-- --dict:27/40(L)--
Current allocation mode is local
Last OS error: 28
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
convert: Postscript delegate failed `/home/gmapfp/test/vitry/images/livresfp/5/bulletin202016.compressed.pdf': mNul.cache @ error/pdf.c/ReadPDFImage/638.
convert: missing an image filename `/home/gmapfp/test/vitry/images/livresfp/5/bulletin202016.compressed.pdf-%d.jpg' @ error/convert.c/ConvertImageCommand/2940.
And I don't see error in my pdf file !

What is this message ?

Re: Error codes

Posted: 2016-10-03T12:12:18-07:00
by snibgo
It tells you that your very old version (v8.71) of Ghostscript had problems reading the PDF. Try upgrading GS.

Re: Error codes

Posted: 2016-10-19T11:27:56-07:00
by fabrice4821
Hi,

Sorry for the time of the pause.

The vesrion on the server is : ImageMagick 6.6.0-4 2015-11-27 Q16

How I check the version of Ghostscript ?

Re: Error codes

Posted: 2016-10-19T11:52:30-07:00
by fmw42
gs --version

Re: Error codes

Posted: 2016-10-20T00:57:36-07:00
by fabrice4821
The return is:
Array ( [0] => Version: ImageMagick 6.6.0-4 2015-11-27 Q16 http://www.imagemagick.org [1] => Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC [2] => Features: OpenMP [3] => [4] => 8.71 )
I'm on shared hosting and I can't upgrade the ImageMagick version.
Is there another solution for use this libraries ?

Re: Error codes

Posted: 2016-10-20T10:14:46-07:00
by fmw42
That version is over 350 versions old. I suggest you try to get your ISP to upgrade or threaten to go to a different ISP.

You never answered the question about what version of ghostscript you are using.