Page 1 of 1
newbie question: converting images
Posted: 2008-10-27T07:21:59-07:00
by nemephis
Hi there!
I'm new to ImageMagick and I can't get it to work but I need it to convert images into CMYK images for use in PDF's.
I've searched this forum and other websites but their suggestions don't work. I'm probably doing something wrong but I dunno what...
Version: ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
is what the Red Hat Linux server tells me so I thought everything is ready to go.
In PHP-script I got these lines:
Code: Select all
$input = "rose.jpg";
$output = "testmap/roos.gif";
exec("convert $input $output");
When I go to the script in the browser nothing happens: No error but also no output-img - just a blank page...
Please tell me, what am I doing wrong?
thnx in advance and excuses for my poor english
Re: newbie question: converting images
Posted: 2008-10-27T10:20:39-07:00
by fmw42
nemephis wrote:Hi there!
I'm new to ImageMagick and I can't get it to work but I need it to convert images into CMYK images for use in PDF's.
I've searched this forum and other websites but their suggestions don't work. I'm probably doing something wrong but I dunno what...
Version: ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
is what the Red Hat Linux server tells me so I thought everything is ready to go.
In PHP-script I got these lines:
Code: Select all
$input = "rose.jpg";
$output = "testmap/roos.gif";
exec("convert $input $output");
When I go to the script in the browser nothing happens: No error but also no output-img - just a blank page...
Please tell me, what am I doing wrong?
thnx in advance and excuses for my poor english
I am not a PHP expert, perhaps Bonzo can help you more here. But I am not sure your exec command is complete enough. Check the PHP web site for the full syntax of exec. Also you probably need to give it the correct path to where you have IM installed. Also try converting your output to the same directory as the input (your default directory) and see if that works.
Here is my syntax for using exec. See if this simple command returns your im version.
<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>
Re: newbie question: converting images
Posted: 2008-10-27T13:40:55-07:00
by Bonzo
nemephis code should work as is but as Fred says you may need the path to convert. I can just use convert but you may need something like /user/local/bin/convert run this and it should tell you the path to convert:
Are you running php as a localhost ? If so you will need to CHMOD your folder for the new image to 777
To get more information on any errors try this:
Code: Select all
<?php
$input = "rose.jpg";
$output = "testmap/roos.gif";
$array=array();
echo "<pre>";
exec("convert $input $output 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
?>
Re: newbie question: converting images
Posted: 2008-10-28T05:15:19-07:00
by nemephis
Thanks for your reaction guys !
It turned out to be a rights-issue: Admin just changed rights on the server and now everything works like a charm: Great!!!!