Using ImageMagick without shell_exec()


I used the following with ImageMagic on an old server and it worked great.

      $im_size = getimagesize($im_path . $im_file);
      if ($im_size[0]>70 && $im_size[1]>55)      shell_exec('im convert '.$im_path . $im_file .' -resize 70x55 +profile "*" '.$im_path.'thumbs/'.$im_file);      
      else      shell_exec('im convert '.$im_path . $im_file .' +profile "*" '.$im_path.'thumbs/'.$im_file);      

My new hosting company claims to offer support for ImageMagick but they don't support shell_exec.

Is there a way to do the above without using shell_exec?"

LVL 16
Who is Participating?
hernst42Connect With a Mentor Commented:
You might try using a native extension for the ImageMagick library. It requires that those extension is compiled (not part of php) and brought to the server by that hosting company.

If they are not willing to do that and there is no possibility to run shell_exec there is no way to use ImageMagick.

I guess all other shell-exec funtion like popen, `command` are also disabled.
RoonaanConnect With a Mentor Commented:
Look at the gdlib functions at the php manual:
imagecreate() etc.

You can use<?php phpinfo(); ?> to check for compatibility your hosting claimes to offer.


Hm guess the gd-lib has no possebility to add a profile (ICM, IPTC-tags) like IM, but might be better than nothing
All Courses

From novice to tech pro — start learning today.