| wurzel |
|
NetHosted Customer
Joined: 20 Jan 2005 Posts: 112 Location: Loughborough, Leics
|
Posted: Thu Oct 11, 2007 7:26 am Post subject: Imagemagick/Imagick |
| |
I want to try out Imagemagick (Imagick) .....
Is it installed on the server? I'm on Saturn.
I've tried a quick php script, and guess I'm missing something
<code>
$animation = new Imagick();
$animation->setFormat( "gif" );
</code>
This fails with a "Class 'Imagick' not found" error, so is there something I should declare first before launching into the script?
All advice gratefully received! _________________ Kev Maggs
Part-time webdesigner - www.cynara.co.uk  |
|
| Back to top |
|
| NetHosted - Andrew |
|
NetHosted Staff

Joined: 22 Mar 2004 Posts: 5684
|
Posted: Thu Oct 11, 2007 9:35 am Post subject: |
| |
Kev,
I can confirm it is installed, how to use it however I am not so sure!
Andrew _________________ | Andrew Bassett
| Managing Director, NetHosted Ltd.
| Resellers, take a look at overselling !
| Members, tell us what you think of NetHosted! |
|
| Back to top |
|
| welcome2 |
|
NetHosted Customer
Joined: 05 Jun 2005 Posts: 122 Location: sandwell
|
Posted: Thu Oct 11, 2007 7:38 pm Post subject: |
| |
I've used GD a couple of times, but not Image Magick, however if I may quote a function from Open Realty: - | Code: | function make_thumb_imagemagick ($input_file_name, $input_file_path)
{
// makes a thumbnail using ImageMagick
global $config;
// Specify your file details
$current_file = "$input_file_path/$input_file_name";
$max_width = $config['thumbnail_width'];
// Get the current info on the file
$current_size = getimagesize($current_file);
$current_img_width = $current_size[0];
$current_img_height = $current_size[1];
// $image_base = explode('.', $current_file);
// This part gets the new thumbnail name
// $image_basename = $image_base[0];
// $image_ext = $image_base[1];
$thumb_name = $input_file_path . "/thumb_" . $input_file_name;
$thumb_name2 = "thumb_" . $input_file_name;
$too_big_diff_ratio = $current_img_width / $max_width;
$new_img_width = $max_width;
$new_img_height = round($current_img_height / $too_big_diff_ratio);
$path = $config['path_to_imagemagick'];
// Convert the file
$debug_path = '"' . $path . '" -geometry ' . $new_img_width . 'x' . $new_img_height . ' "' . $current_file . '" "' . $thumb_name . '"';
$debug = exec($debug_path);
@chmod("$input_file_path/$thumb_name", 0777);
return $thumb_name2;
} // end function make_thumb
|
It appears that it has to be called as an executable ($debug = exec($debug_path); )
I've never heard of "Imagick", but I would guess it's a Class that provides a set of handlers for it, so you would need to include() that class first. _________________ Jim |
|
| Back to top |
|
| welcome2 |
|
NetHosted Customer
Joined: 05 Jun 2005 Posts: 122 Location: sandwell
|
Posted: Thu Oct 11, 2007 8:24 pm Post subject: |
| |
And now that I've looked in the PHP manual, and found Imagick listed, albeit not documented much
It seems it's a PECL extension that's not bundled with php
http://www.php.net/manual/en/imagick.install.php
Also it looks like most of the functions say | Quote: | Warning:
This function is EXPERIMENTAL. The behaviour of this function, the name of this function, and anything else documented about this function may change without notice in a future release of PHP. Use this function at your own risk.
|
_________________ Jim |
|
| Back to top |
|
User Permissions |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
| |