Solved

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

Posted on 2007-11-15
6
3,913 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

838 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