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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.