Solved

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

Posted on 2007-11-15
6
3,902 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
can windows 10 wamp send mail()? 3 32
what is best version of php to use 6 44
form button worked now it doesnt anymore 9 37
converting numbers with php 3 26
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses four methods for overlaying images in a container on a web page
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

929 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

12 Experts available now in Live!

Get 1:1 Help Now