Solved

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

Posted on 2007-11-15
6
3,924 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

739 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