ImagiMagick simple testing script

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
Glostar

ImagiMagick simple testing script

Post by Glostar »

I bought a webhost from hosting provider. But ImageMagick does not work. Hosting provider said ImageMagick is installed.

But ImageMagick still do not work! I think it is not installed properly :(

So, I need any simple test script to test ImageMagick if it works or not. I need real visual evidence for hosting provider to tell him that Imagimagick is not properly installed. I looked through this site but didn't see any test script.

Please give me any recommendation and testing script(s).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImagiMagick simple testing script

Post by fmw42 »

First see if one of these works:

<?php
system("/usr/local/bin/convert -version");
?>

<?php
$IM_version=shell_exec("/usr/local/bin/convert -version");
echo $IM_version
?>

<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>


You may have to change the path to wherever your host has IM. Another path might be /user/bin/convert.
Glostar

Re: ImagiMagick simple testing script

Post by Glostar »

fmw42 wrote:First see if one of these works:

<?php
system("/usr/local/bin/convert -version");
?>

<?php
$IM_version=shell_exec("/usr/local/bin/convert -version");
echo $IM_version
?>

<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>


You may have to change the path to wherever your host has IM. Another path might be /user/bin/convert.
these 3 code gives:

1.
Version: ImageMagick 6.5.1-0 2009-04-03 Q16 OpenMP http://www.imagemagick.org Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

2.
Version: ImageMagick 6.5.1-0 2009-04-03 Q16 OpenMP http://www.imagemagick.org Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

3.
Version: ImageMagick 6.5.1-0 2009-04-03 Q16 OpenMP http://www.imagemagick.org

I KNOW that ImageMagick IS INSTALLED but It do NOT work, I have tested with two my scripts. It do not show image at registration page with image verification.

I need any ImageMagick simple testing script,
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: ImagiMagick simple testing script

Post by Bonzo »

This code will give you the path to ImageMagick:

Code: Select all

<?php
echo "<pre>";
system("type convert"); 
echo "</pre>";
?> 
I can run my code with just convert but depending on the setup you may need to use /usr/local/bin/convert - depending what the code above displays.

A simple script:

Code: Select all

<?php
// Replace input.jpg with the name of a jpg image in the same folder as this code and run it.
exec("convert input.jpg -thumbnail 50x50 output.jpg");
?>
<img src="output.jpg">
Glostar

Re: ImagiMagick simple testing script

Post by Glostar »

I did this test, but ImageMagick do not work still.

Code: Select all

<?php
echo "<pre>";
system("type convert"); 
echo "</pre>";
?> 
the bove code gives the path /usr/local/bin/convert
please see here http://www.aba10.com/mmdir/image_magick ... Magick.php

Code: Select all

<?php
// Replace input.jpg with the name of a jpg image in the same folder as this code and run it.
exec("convert input.jpg -thumbnail 50x50 output.jpg");
?>
<img src="output.jpg">
the above code does not convert image input.jpg into output.jpg
please see here
http://www.aba10.com/mmdir/image_magick ... e-test.php
the directory http://www.aba10.com/mmdir/image_magick_test/IM-Forum2/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: ImagiMagick simple testing script

Post by Bonzo »

You could try this and see if you get any errors, if it still does not work I would contact your hosts.

Code: Select all

<?php

echo "Using convert:<br>";
$array = array();
echo "<pre>";
// Replace input.jpg with the name of a jpg image in the same folder as this code and run it.
exec("convert input.jpg -thumbnail 50x50 output1.jpg 2>&1", $array);
print_r( $array );
echo"</pre>";

echo "Using /usr/local/bin/convert:<br>";
$array = array();
echo "<pre>";
// Replace input.jpg with the name of a jpg image in the same folder as this code and run it.
exec("/usr/local/bin/convert input.jpg -thumbnail 50x50 output2.jpg 2>&1", $array);
print_r( $array );
echo"</pre>";

?>
<img src="output1.jpg"><br>
<img src="output2.jpg">
Glostar

Re: ImagiMagick simple testing script

Post by Glostar »

ImageMagick do not work still, I got error, please see here http://www.aba10.com/mmdir/image_magick ... t-test.php
and directory is here http://www.aba10.com/mmdir/image_magick_test/IM-Forum2/

I am with contact of hosting provider many days about ImageMagick problem. They reinstalled ImageMagick many times, but They cannot managed to settle the problem. They do not know what to do :(
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: ImagiMagick simple testing script

Post by Bonzo »

Have you CHMOD your dirctory you are saving the image in to 777 or 755 ?
Post Reply