is it new Imagick($image); supported by 5.5.6 version, seems

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
lse123
Posts: 15
Joined: 2012-03-08T14:22:30-07:00
Authentication code: 8675308

is it new Imagick($image); supported by 5.5.6 version, seems

Post by lse123 »

The subject of this post posted and to: http://www.dynamicdrive.com/forums/show ... post270997

where send me to this forum...
I ask almost same Q here:

Code: Select all

<?php
header('Content-Type: image/png');
system("convert http://www.polisphotos.com/jQueryPb/images/ui-icons_ef8c08_256x240.png -flop png:-");
?>
this worked right as you see at http://www.polisphotos.com/jQueryPb/7-i ... agick3.php

well what if I want to use $im = new Imagick($image); // to built web forms that modify images // not use system... is it new Imagick($image); supported by 5.5.6 version?

http://www.polisphotos.com/jQueryPb/7-i ... agick1.php the below does not work, gives:

Code: Select all

Fatal error: Class 'Imagick' not found in /home/content/p/o/l/polisphotos/html/jQueryPb/7-imagick/imagick1.php on line 20
code in imagick1.php:

Code: Select all

<body>
<p>&nbsp;</p>
<p><img src="http://www.polisphotos.com/jQueryPb/images/ui-bg_diagonals-thick_18_b81900_40x40.png" width="40" height="40" /></p>
<p>
  <?php

try
{
        /*** a valid image file ***/
        $image = 'http://www.polisphotos.com/jQueryPb/images/ui-bg_diagonals-thick_18_b81900_40x40.png';

        /*** a new imagick object ***/
        $im = new Imagick($image);

        echo 'Imagick';
}
catch(Exception $e)
{
        echo $e->getMessage();
}

?>
</p>
<p></p>
<p><a href="http://www.polisphotos.com/jQueryPb/7-imagick/imagick1.php">
  http://www.polisphotos.com/jQueryPb/7-imagick/imagick1.php</a></p>
</body>
lse123
Posts: 15
Joined: 2012-03-08T14:22:30-07:00
Authentication code: 8675308

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by lse123 »

Code: Select all

        $im = new Imagick($image); // [b]line 20[/b]
lse123
Posts: 15
Joined: 2012-03-08T14:22:30-07:00
Authentication code: 8675308

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by lse123 »

http://www.polisphotos.com/jQueryPb/7-3 ... images.php

here is a web form to modify images, but does not work ch. 7-3-rotation, Packt Publ jQuery 1.3 with PHP (c)2009 book...
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by Bonzo »

Fatal error: Class 'Imagick' not found in /home/content/p/o/l/polisphotos/html/jQueryPb/7-imagick/imagick1.php on line 20
I would say Imagick is not installed.

You can check if you display your php.ini file.

Your first example using system() is using Imagemagick.
lse123
Posts: 15
Joined: 2012-03-08T14:22:30-07:00
Authentication code: 8675308

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by lse123 »

you mean: new Imagick($image); // needs Imagick, and Imagick and Imagemagick differ? my hosting can tell this? also what command tell it(I forget can you remind how do with php.ini file?)?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by Bonzo »

you mean: new Imagick($image); // needs Imagick, and Imagick and Imagemagick differ?
Yes that is correct

Put this code into a page and save as server.php Upload it and navigate to the page. It will display the php.ini information as well as a lot of information about Imagemagick

Code: Select all

<?php
system("type convert");
echo "<br>";
system("convert -version");

echo "<br>";
echo "<pre>";
system("convert -LIB_VERSION_NUMBER");
system('which convert',$path); print_r($path); 
echo "</pre>";
phpinfo();
?>

<?php
// Build the array of items to be used
exec("convert convert -list list", $IMarray, $code);
// Start the loop to find and display the results
foreach ($IMarray as $value) {
echo "<br>system (\"convert -list $value\")";
echo "<pre>";
system("convert -list $value");
echo "</pre><hr>";
}
?>
lse123
Posts: 15
Joined: 2012-03-08T14:22:30-07:00
Authentication code: 8675308

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by lse123 »

I did this...

convert is /usr/bin/convert
Version: ImageMagick 5.5.6 04/01/03 Q16 http://www.imagemagick.org Copyright: Copyright (C) 2003 ImageMagick Studio LLC

Version: ImageMagick 5.5.6 04/01/03 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 2003 ImageMagick Studio LLC


ImageMagick appear only in above...IMagick never appears expect my url that contains it...
lse123
Posts: 15
Joined: 2012-03-08T14:22:30-07:00
Authentication code: 8675308

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by lse123 »

my hosting says Imagick not supported...

Imagemagick and Imagick both how install local host windows in xampp(bin install) install?

###### ApacheFriends XAMPP (Basispaket) version 1.7.4 ######

+ Apache 2.2.17
+ MySQL 5.5.8 (Community Server)
+ PHP 5.3.5 (VC6 X86 32bit) + PEAR
+ XAMPP Control Version 2.5 from www.nat32.com
+ XAMPP Security
+ SQLite 2.8.15
+ OpenSSL 0.9.8o
+ phpMyAdmin 3.3.9
+ ADOdb 5.11
+ Mercury Mail Transport System v4.62
+ FileZilla FTP Server 0.9.37
+ Webalizer 2.01-10
+ Zend Optimizer 3.3.0
+ Perl 5.10.1
+ Mod_perl 2.0.4
+ Tomcat 7.0.3

---------------------------------------------------------------
Last edited by lse123 on 2012-03-13T14:48:44-07:00, edited 1 time in total.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by Bonzo »

Imagemagick is easy to install:
Download and install ImageMagick: http://www.imagemagick.org/script/binar ... hp#windows
Start XAMPP
Run this code in your browser to prove it is installed and working.
<?php
header("Content-Type: text/plain");
system("convert -version");
?>
Use the code like this and run it in your browser:
<?php
exec("convert input.jpg -thumbnail 100x100 output.jpg");
?>

Note: You will need to use " not ' when using draw or annotate as this is a windows installation. The " will need escaping if you are writing the code like exec("convert ......
localhost must be running for the code to work.
Imagick WILL BE A PAIN the main problem is finding a dll to go with the XAMPP php version and the Windows software.
Why do you want to use Imagick rather than Imagemagick?
lse123
Posts: 15
Joined: 2012-03-08T14:22:30-07:00
Authentication code: 8675308

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by lse123 »

see the edited post prior this, mine edition xampp...

imagick() is go with php so want it...and my "jquery and php" by packt pub book refers it. Well Imagemagick with php is all about use system or...? Imagemagick can be used from html web forms(that modify properties rotate, resize...etc) in webpages.php?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by Bonzo »

Check out my website in signature below for php Imagemagick examples.

I had Imagick running on both XP and Vista but when upgrading XAMPP it stopped working.

As I say you need a dll that has been compiled? with the correct version of whatever and it must also support the version of php you have.

Imagick is not very well supported, very little documentation and the documentation there is will work on one version of Imagick and not the next.
It will only work with the operators that have been added to it and in my opinion it is more complicated than using exec() and the command line functions.

There are very few people here that can help you install it and you can look back through the previous forum posts to see the problems.
lse123
Posts: 15
Joined: 2012-03-08T14:22:30-07:00
Authentication code: 8675308

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by lse123 »

"... using exec() and the command line functions. ..."

YOU SAY BY THIS THE BELOW CAN NOT BE DONE?

Imagemagick can be used from html web forms(that modify properties rotate, resize...etc) in webpages.php?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by Bonzo »

Imagemagick can be used from html web forms(that modify properties rotate, resize...etc) in webpages.php?
You can use Imagick or Imagemagick with forms - looks like my code examples need updating at least for the latest version of php!

Code: Select all

<?php
function clean($name, $max) {
// Remove everything except letters numbers . and @ in the variable
preg_replace("/[^A-Za-z0-9.\-_@]/","",$name);

// Do not allow excessively long entries
$name = substr($name, 0, $max);
return $name;
}

// If the form has been submitted do this
if ( $Submit ) { 
 
// Temporary upload image name 
$original_image = $_FILES['filename']['tmp_name'];

// Name to save the image as - in this case the same as the original 
$new_image = $_FILES['filename']['name'];  
 
$text_submitted = $_POST['text_submitted'];

$text_submitted = clean ( $text_submitted, 18 );

$text = preg_split('//', $text_submitted, -1, PREG_SPLIT_NO_EMPTY);
$total = count ( $text );

for ( $i=0; $i < $total; $i++ )
    { 
 if ( $text[$i] == " "){$text[$i] = 88 ;} 
 $text[$i] = $text[$i].".gif ";
 $text_array = $text_array.$text[$i];
    }

$cmd = "$original_image -pointsize 50 -font Arial -fill rgba\(0,0,0,0.4\) ".
" -gravity center -annotate +0+0 $text_array ";
exec("convert $cmd $new_image");
            }
                        
else { ?>

<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<label>File to upload</label> 
<input type="file" name="filename"  /> 
<label>Text to add to the photo</label>
<input type="text" name="text_submitted"  /><br />
<input type="Submit" name="Submit" value="Submit" />
</form>
 <?php } ?>  
lse123
Posts: 15
Joined: 2012-03-08T14:22:30-07:00
Authentication code: 8675308

most adaptable to php code

Post by lse123 »

a.Imagick or b.Imagemagick
can you tell which is easiest, most productive, self explained, most adaptable to php code? a or b for each
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: is it new Imagick($image); supported by 5.5.6 version, s

Post by Bonzo »

In my opinion:

a.Imagick or b.Imagemagick

easiest = b
productive = a might be slightly faster
self explained = b
adaptable to php code = b

Example of Imagick

Code: Select all

<?php 
$thumbnail = new Imagick("flowers.jpg");
$thumbnail->thumbnailImage( 100, 0 );
$thumbnail->writeImage( "thumbnail.jpg" );
?>
Example of Imagmagick

Code: Select all

<?php 
exec("convert flowers.jpg -thumbnail 100x100 thumbnail.jpg" );
?>
Post Reply