Solved

How to use ImageMagick "convert path" with PHP on Linux Shared Hosting?

Posted on 2007-11-15
6
3,920 Views
Last Modified: 2011-01-09
Hello I have a shared hosting Linux account and I am interested in using ImageMagick with PHP.

All they provide me with is the "convert path" and they say go to imagemagick.com for more information.

I then went to php.net/imagick and got some instructions and tried to create a new object by calling:

$image = new Imagick();

but the Imagick object was never recognized.  Any help is much appreciated.
0
Comment
Question by:parlays
  • 3
  • 2
6 Comments
 
LVL 21

Expert Comment

by:nizsmo
ID: 20297251
have you tried the basic code like this:
<?php

header('Content-type: image/jpeg');

$image = new Imagick('image.jpg');

// If 0 is provided as a width or height parameter,
// aspect ratio is maintained
$image->thumbnailImage(100, 0);

echo $image;

?>

and does it work? if it doesn't, what errors does it output?
0
 

Author Comment

by:parlays
ID: 20302643
Thanks for the response buddy.

When I input that it spits out:
Fatal error: Class 'Imagick' not found in /home/content/f/r/a/frankbongiorno/html/manage/add/test1.php5 on line 28

On the godaddy server they tell me the convert path is : '/usr/local/bin'  ... but I have no idea how to implement or use that info.

Yesterday I was experimenting and used on of the commands :     system ('convert .......') or exec('convert ......') and it seemed to work like that but I'd much rather use the PHP interface.

I'm not sure if I have to install the Imagick class or something.  It says that it is a native PHP extension, which I thought means it's included on all PHP installations.

Here is the information that GoDaddy gives, it's pretty useless but maybe worth checking out:
http://help.godaddy.com/article.php?article_id=209&topic_id=

Thanks for the help, been searching the web nonstop finding nothing, I increased the point value to 500 because I realize this is a tough question and not much info out there about it.
0
 
LVL 21

Accepted Solution

by:
nizsmo earned 500 total points
ID: 20302718
http://www.imagemagick.org/Usage/

Basically imagemagick by itself is a command line tool and you would be correct in saying that you have to use system() or exec() to execute its functions.

imagick is a package extension provides a wrapper for ImageMagick library, so that you can (as you want to) use imagemagick directly from PHP.

Now the unfortunate thing is that godaddy does not have the Imagick extension installed, so you are stuck with executing using system() or exec() to work with ImnageMagick.

If you are really needing Imagick, i suggest you have to get a VPS or go with some other host who allows you to install custom extensions or have Imagick pre-installed already.

I heard from someone that this webhost has Imagick installed by default, but I fail to find that anywhere on their site.

Hope this information helps a little.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 21

Expert Comment

by:nizsmo
ID: 20302722
forgot to include the link for "this host":
http://networkredux.com/

But it is probably not very important anyway.
0
 

Author Closing Comment

by:parlays
ID: 31409463
thanks!
0
 

Expert Comment

by:PhillipWelch
ID: 33795294
http://help.godaddy.com/article/208
Goaddy does support imagemagick
ImageMagick is a powerful set of image manipulation utilities that you can access through your code to create, edit, and compose bitmap images. There are many Web applications that use ImageMagick to manipulate images. If you are an experienced programmer, you can use Perl or PHP to access ImageMagick's convert utility.

Using ImageMagick, you can:

Convert an image from one format to another.
Resize, rotate, or add special effects to an image.
Easily create thumbnails on your Web page.
Create a transparent image suitable for use on the Web.
Turn a group of images into a GIF animation sequence.
Create a composite image by combining several separate image.
Draw shapes or text on an image.
All of our Linux hosting plans include ImageMagick. The convert path to ImageMagick, version 5 on our servers is
/usr/bin/
The convert path to ImageMagick, version 6 on our servers is:

/usr/local/bin/
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Php logic to add to date card 9 37
Length of for loop to be dynamic 2 31
How Close unsubmited attempts 10 42
Make login page safer 3 30
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

680 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