ImageMagick allows you to dynamically create and edit images on the server.  ImageMagick is usually run from the command line, but since command line access is not available on Web Hosting Hub servers, the commands can be ran through cron jobs or PHP scripts instead. ImageMagick programs are located in:

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

Using ImageMagick

For more information on using ImageMagick, please see the ImageMagick documentation:

Examples:

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 commands ran through either a cron job or from a PHP script will resize the image and name the new image to resize_image.jpg.

Running ImageMagick from a cron job

Set up a cron job with the following command:

/usr/bin/convert public_html/image.jpg -resize 64x64 public_html/resize_image.jpg

Running ImageMagick from a PHP script

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');

Replace USERNAME with your actual cPanel username (e.g. userna5) and make sure that the folder you are writing the image to has file permissions set to 755.

Did you find this article helpful?

Login to comment.

Your Opinion Matters

... but we need to know what you're thinking!

The Community Support team wrote the article you're looking at now. We like to think it's perfect, but we're sure you have some suggestions. Please, let us know what they are!

Feedback
Your Email Address
Because we'd like to talk with you!

Support Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

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

Not a Customer?

Get web hosting from a company that is here to help.