Solved

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

Posted on 2007-11-15
6
3,896 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
Comment Utility
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
Comment Utility
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
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 21

Expert Comment

by:nizsmo
Comment Utility
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
Comment Utility
thanks!
0
 

Expert Comment

by:PhillipWelch
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now