Imagemagick usage without PHP exec function

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick usage without PHP exec function

Post by fmw42 »

HarPaddy wrote:Hi.

I have a problem with imagemagick.

Imagemagick has been installed on my server, but "exec()" has been disabled for some security reasons . I am having FastCGI has been enabled on server and i can use binary conversion of imagemagick.

Can u please help me how to generate thumbnails using imagemagick with PHP functions without using "exec()" command? I am struggling with this from long time. Please help me out.

Thanks,
HarPaddy
I am not an expert with PHP, but first you need to know where IM is installed, usually /usr/local/bin or /usr/local.

Then try using either system or shell exec:

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


or

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

Do either of those return the IM version?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Imagemagick usage without PHP exec function

Post by Bonzo »

If fmw42's ideas do not work you could see if Imagick is installed by trying one of their examples:

Code: Select all

<?php 
$thumbnail = new Imagick("input_image.jpg");
$thumbnail->thumbnailImage( 100, 0 );
$thumbnail->writeImage( "thumbnail.jpg" );
?> 
You should probably be posting this in the Users section of the forum.
Post Reply