Need Help Accessing Imagemagick!!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
owsdeveloper
Forum Newbie
Posts: 8
Joined: Fri Aug 19, 2011 5:24 am

Need Help Accessing Imagemagick!!!

Post by owsdeveloper »

I was up to speed with PHP a few years ago but got sidetracked. I a now getting back into it but am quite rusty so some help would be greatly appreciated.

Right, here is my problem:

The web hosting i use has apparently got Imagemagick installed. The most information i can get from them is that "We do support imagemagick and it is installed already on the server. The path is /usr/bin/convert." They then i could try "/usr/bin".

When i try to run the following script:

<?php
$image = new imagick( "image/service/consult.jpg" );
$points = array(
0,0, 25,25, # top left
176,0, 126,0, # top right
0,135, 0,105, # bottom right
176,135, 176,135 # bottum left
);
$image->setimagebackgroundcolor("#fad888");
$image->setImageVirtualPixelMethod( imagick::VIRTUALPIXELMETHOD_BACKGROUND );
$image->distortImage( Imagick::DISTORTION_PERSPECTIVE, $points, TRUE );
header( "Content-Type: image/jpeg" );
echo $image;
?>


I get this error:

Fatal error: Class 'imagick' not found in /home/design/public_html/script/image/manipulate.php on line 11

Can anyone tell me how i can make use of the information "The path is /usr/bin/convert"?

If you want i can create a testing domain for you so you can try it out directly.

Thanks in advance for any help :)
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Need Help Accessing Imagemagick!!!

Post by twinedev »

When they told you imagemagick was installed, were they referring to both the program and the PHP extensions, or just the actual program?

I myself have never used the extension, and instead am used to using the system() function to execute it via command line.

I am going to look to see if my own server has the imagemagick extention installed and play with it.

-Greg
owsdeveloper
Forum Newbie
Posts: 8
Joined: Fri Aug 19, 2011 5:24 am

Re: Need Help Accessing Imagemagick!!!

Post by owsdeveloper »

Thanks for your reply twinedev, i dont think the person in support at my host has enough knowledge to provide proper answers.

He simply says "We do support imagemagick and it is installed already on the server

The path is /usr/bin/convert. I hope this helps.

Let us know if you've any other questions or need further assistance."

i could create an account for you if you want to try it there?

Dean
genix2011
Forum Commoner
Posts: 74
Joined: Tue Aug 02, 2011 4:00 pm

Re: Need Help Accessing Imagemagick!!!

Post by genix2011 »

Hi,

from the php error it is quite clear, that the imagemagick php extension is not installed on the server, there is just the normal imagemagick program installed.

You could use the system() function to access the imagemagic program.
But if they say, that imagemagick is supported, they should also install the imagemagick php extension.

Greets.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Need Help Accessing Imagemagick!!!

Post by Celauran »

I just installed imagick and its PHP extension on my test machine and your code is working fine. Have you checked through your server's phpinfo() to verify that the PHP imagick extension is, in fact, there?
owsdeveloper
Forum Newbie
Posts: 8
Joined: Fri Aug 19, 2011 5:24 am

Re: Need Help Accessing Imagemagick!!!

Post by owsdeveloper »

i checked phpinfo, cant see it, its here if you dont mind doublechecking for me:

http://design.openwebservices.co.uk/phpinfo.php

how do i use the system function? can you give me a couple of simple examples and i will work it out from there?

As i said, im just getting back into php coding so need a few pointers.

thanks
owsdeveloper
Forum Newbie
Posts: 8
Joined: Fri Aug 19, 2011 5:24 am

Re: Need Help Accessing Imagemagick!!!

Post by owsdeveloper »

apparently system() has been disables on the server:

Warning: system() has been disabled for security reasons in /home/design/public_html/imagicktest.php on line 12
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Need Help Accessing Imagemagick!!!

Post by Celauran »

If they've disabled system() and they don't have the imagick php extension (I double checked your phpinfo() -- they don't), they essentially don't have imagick available to you.
owsdeveloper
Forum Newbie
Posts: 8
Joined: Fri Aug 19, 2011 5:24 am

Re: Need Help Accessing Imagemagick!!!

Post by owsdeveloper »

am i right in thinking the information they gave me "The path is /usr/bin/convert" is of no use to me in solving this? The only way to fix this is if they install the imagick php extension? if so i am going to contact them to see if they will install it...
owsdeveloper
Forum Newbie
Posts: 8
Joined: Fri Aug 19, 2011 5:24 am

Re: Need Help Accessing Imagemagick!!!

Post by owsdeveloper »

they now say:

"Try using /usr/local/bin/convert as the path, if /usr/bin/convert is not working."

they say use it as the path - where/how do i use this path?
Last edited by owsdeveloper on Fri Aug 19, 2011 11:40 am, edited 1 time in total.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Need Help Accessing Imagemagick!!!

Post by Celauran »

With system() disabled, I don't see how that's of any use to you.
owsdeveloper
Forum Newbie
Posts: 8
Joined: Fri Aug 19, 2011 5:24 am

Re: Need Help Accessing Imagemagick!!!

Post by owsdeveloper »

i got on to the hosting company and they have installed the php extension so hopefully i can get some results now.

Thanks for the advice/help guys.

Dean
Post Reply