InMotion Hosting Support Center

ImageMagick allows you to dynamically create and edit images on the server. It will need to be ran from the command line as none of the API's are installed. ImageMagick is already available for utilization on the servers. It is located at:

  • /usr/bin/convert
  • /usr/bin/mogrify

ImageMagick homepage -http://www.imagemagick.com/


Example:
The following are examples to demonstrate that ImageMagick is installed and functioning. If you have a file named image.jpg in your public_html, the following command ran from the command line will resize the image and name the new image to resize_image.jpg:

  • VPS and Dedicated servers with SSH access:
    convert image.jpg -resize 64x64 resize_image.jpg

  • Shared servers with no SSH access: You can setup a cron job with the following command:
    /usr/bin/convert public_html/image.jpg -resize 64x64 public_html/resize_image.jpg

  • Shared servers with no SSH accesss: You can run the following command from a php script:
    exec('/usr/bin/convert /home/USERNAME/public_html/image.jpg -resize 64x64 /home/USERNAME/public_html/resize_image.jpg');

    Please note that in this example you will need to replace USERNAME with your actual username.
    You will also need to make sure that the folder you are writing resize_image.jpg to has write permissions.

Support Center Login

Social Media Login

   
Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
imagemagick installed on VPS
Can I easily make PrestaShop use ImageMagick instead of GD?
installation of imagemagik in the hosting
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
2013-04-05 10:16 am
This article is lacking an example using VPS and a command from a php script. Please update.
2013-04-10 9:12 am
Additional note: we found after trial and error IM works, it just wasn't converting pdf files which was what we needed. IM requires GhostScript. The VPS server may come with IM installed but you may need to request GS be installed.
Staff
17,070 Points
2013-04-10 11:52 am
Hello drom95,

Thank you for your suggestions, we will update this article as soon as posible.

If you have any further questions, feel free to post them below.
Thank you,

-John-Paul
n/a Points
2015-02-12 12:11 pm

I am trying to install a script from iscripts called printlogic. I cant seem to get it to install because of the following error.

Checking IMAGICK support... Off-Please re-compile php with IMAGICK supportFatal errors detected. Please correct the above red items and reload.

How is this error corrected? I do have a SSL but I am nost sure where and how to make corrections or add code or change code.. Basically I dont have a clue.

 

Staff
17,070 Points
2015-02-13 12:44 pm
Hello April,

Thank you for your question. ImageMagick is already available for utilization on the servers, please see our guide Is ImageMagick installed on my server?

If you have any further questions, feel free to post them below.

Thank you,
John-Paul
2015-06-19 7:17 am
Here's a php snippet I came up with for this:

<?php

function resizeImage($image_path, $new_width, $new_height) {
if( !class_exists("Imagick") ) {
$rel_upload_dir = "uploads/"; //Your
$root = $_SERVER["DOCUMENT_ROOT"];
$root_upload_dir = $root . "/portal/uploads";

//Get the root path for the images..
$old_img = str_replace($rel_upload_dir, $root_upload_dir, $image_path);
$new_img = str_replace(".jpg", "_thumb.jpg", $old_img);

//Generate the command..
$cmd = "/usr/bin/convert {$old_img} -resize {$new_width}x{$new_height} {$new_img}";

$return = null;

//Execute the command
exec($cmd, $return, $return);


$new_img_dir = str_replace($root_upload_dir, $rel_upload_dir, $new_img);

return new_img_dir;
}
else {
//Use Imagick
}
}

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

7 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!