Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Using ImageMagick without shell_exec()

Posted on 2004-11-01
Medium Priority
Last Modified: 2012-06-21

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?"

Question by:hankknight
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 48

Accepted Solution

hernst42 earned 1000 total points
ID: 12466994
You might try using http://pecl.php.net/package/imagick 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.
LVL 49

Assisted Solution

Roonaan earned 1000 total points
ID: 12467009
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.


LVL 48

Expert Comment

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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question