Strange problem with convert

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dhrubo
Posts: 1
Joined: 2013-09-03T04:57:29-07:00
Authentication code: 6789

Strange problem with convert

Post by dhrubo »

Hi,

I'm in a strange problem. I'm trying to export brytum gantt chart in pdf/png.

I'm about to complete the export, but a strange problem i'm facing.

Code: Select all

$imgkOut = array();

                //run imagemagick merging separate png's into one pdf or png depending on the file format
                if ($fileFormat == 'pdf'){
                    $cmd = $imgkPath.'convert '.$pdfs.' "'.$outputPath.'/'.$out.'"';
                } else {
                    $cmd = $imgkPath.'montage -mode concatenate -tile 1x '.$pdfs.' "'.$outputPath.'/'.$out.'"';
                }
                exec($cmd, $imgkOut);

This is one of my code sample.
here, in the exec function command is not executing successfully.

I've got the value of $cmd which is : convert D:\PHP\xampp\htdocs\export/print-1378204549859.png D:\PHP\xampp\htdocs\export/print-1378204550271.png "D:\PHP\xampp\htdocs\export/complete-exportedPanel0.634509001378204542.pdf"

If i run this command from command prompt, then the command is executing successfully, even it is write a block of code in another php file like :

Code: Select all

$imgkOut = array();
$cmd = 'convert D:\PHP\xampp\htdocs\export/print-1378204549859.png D:\PHP\xampp\htdocs\export/print-1378204550271.png  "D:\PHP\xampp\htdocs\export/complete-exportedPanel0.634509001378204542.pdf"';
$imgkOut = exec($cmd);
at this time also the pdf is creating. But bad luckily, in the project, the pdf is not creating.

I've no idea, why this is not working under the project. But i'm getting the same value in $cmd variable.

Please help me someone. This strange problem is ruining my all day long. Sorry for my bad english :)

Thanks
Dhrubo
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Strange problem with convert

Post by snibgo »

What error messages do you get?

What happens when you run that command at the command line?

What version of ImageMagick and what platform?
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Strange problem with convert

Post by Bonzo »

I presume $imgkPath does not already contain convert?
Is there a / between the path and convert?

The $cmd line looks way to complicated - try and keep it simple so you can see what is going on. I would write it like this:

Code: Select all

$output = $outputPath.'/'.$out;
$imgkPath = $imgkPath.'convert';
$cmd = "$imgkPath $pdfs $output";
I see you are using XAMPP and I would have put the pdf's within the localhost folder.

As with everything start off with something simple for example all files and code in the same folder so you know the convert is working and when it works then add all the other code.
Post Reply