Page 1 of 1

New ImageMagick / MagickWand extension for php

Posted: 2007-06-11T08:12:20-07:00
by sp0n9e
Imagick has been rereleased by active maintainers at http://pecl.php.net/package/imagick. The implementation is very close to complete with a beta in the next week or two, and documentation should be finished in the next 6 to 8 weeks, including figures and full examples (only the argument list is available now). Just wanted to make you guys aware that a new implementation is out there, and is being actively maintained and developed with windows dll's for beta builds and releases to be rolled automagically at http://pecl4win.php.net (no beta release yet, so no dll's :/)

Re: New ImageMagick / MagickWand extension for php

Posted: 2007-06-11T08:32:09-07:00
by magick
Good news. We'll add a pointer to Imagick from the ImageMagick web pages now that we are reassured it is an actively maintained project.

Re: New ImageMagick / MagickWand extension for php

Posted: 2007-06-11T08:51:10-07:00
by sp0n9e
Oh, I forgot, the documentation is at your favorite php mirror http://php.net/imagick. Here's a little taste of the way the Imagick extension is used

Code: Select all

<?php

$image = new Imagick();

$image->readimage('largeimage.jpg');
// Passing 0 makes scaleImage retain aspect ratio
$image->scaleImage(640,0);
$image->writeImage('mediumimage.jpg');

?>

Re: New ImageMagick / MagickWand extension for php

Posted: 2007-07-23T09:39:46-07:00
by salomsalom
Hi,

I have been using that extension from a week ago. I know that its an experimental extension but it supports reading/writing EPS and PDF files?

In case answer is yes I have an error when I try to read any PDF file, the error is:
Fatal error: Uncaught exception 'ImagickException' with message 'Undefined exception.' in C:\web-php\test.php:14 Stack trace: #0 C:\web-php\test.php(14): Imagick->readimage('test.pdf') #1 {main} thrown in C:\web-php\test.php on line 14
The PHP code is:

Code: Select all

$handle = new Imagick();

$handle -> readImage('test.pdf');
The mistake is produced by the second line

I supposed that maybe it need Ghostscript to read/write EPS and PDF, but after install it I get the same error.

Can anybody help with that,

Thanks.

P.D.: Excuse my bad english

Re: New ImageMagick / MagickWand extension for php

Posted: 2007-07-23T13:50:45-07:00
by mkoppanen
I removed all undefined exceptions in the newest release. Maybe it's not rolled into Windows builds yet. I assume that discussing imagick extension here is a bit off-topic ( I don't know what ImageMagick guys like that ? ).

You should propably configure the delegate for the PDF format. I don't know how that happens in Windows since I don't run imagick on that platform. Reading and writing PDFs in my tests (Linux) works just fine.

--
Mikko Koppanen

Re: New ImageMagick / MagickWand extension for php

Posted: 2007-07-23T14:03:29-07:00
by salomsalom
Yes, probably this is OFF-Topic, and I´m really sorry for that but I didn´t know where I could find any help about this problem. Do you know where??

I dont lnow what you mean with:
You should propably configure the delegate for the PDF format.
Can you explain in detail?

Thanks a lot

Re: New ImageMagick / MagickWand extension for php

Posted: 2007-07-23T14:22:52-07:00
by mkoppanen
Correct me if I am wrong but this happens in delegates.xml file. See: http://www.imagemagick.org/script/resources.php

--
Mikko Koppanen

Re: New ImageMagick / MagickWand extension for php

Posted: 2007-07-23T15:09:16-07:00
by salomsalom
ok, Now I know what are you talking about.

I have installed PHP 5.2.3 with the Windows Installer, this one don´t create any configuration file for Imagick so there isn´t any delegates.xml.

I think I´m really lost!.

Re: New ImageMagick / MagickWand extension for php

Posted: 2007-08-18T04:25:33-07:00
by phpknight
Could you let me know the difference between PHP MagickWand and Imagick?

I really would like to start using ImageMagick, but I am having difficulty getting started.

Re: New ImageMagick / MagickWand extension for php

Posted: 2007-08-20T14:07:35-07:00
by ridera
Here is an Imagick code snippet that should help you get started. I'd put it in the new Imagick Forum; but. it's not active yet.

http://www.ridersite.org/imagemagick/Imagick.php shows the label and some other stuff in the code.

Code: Select all

<?php
/*********************************** Make a nifty label ************************************/

   $report= "<html><body style= \"margin:5%; font-size:12pt\">\n\n";

    $report .= "<p style=\"color:blue; text-align:center\">PHP Imagick Image Library Label Test</p>\n\n";

/* This is the IM command version:
-size 900x85 xc:#ffffee -font Bookman-DemiItalic -pointsize 30 -draw "text 10,60 'Image created and saved: 9 Aug 2007 02:36:38 PM'" -channel RGBA -gaussian 0x6 -fill darkred -stroke magenta -draw "text 5,55 'Image created and saved: 9 Aug 2007 02:36:38 PM'"
*/

	$obj2= 		new Imagick();						//Object
	$draw=		new ImagickDraw();				    //Drawing objects
	$color= 	new ImagickPixel();					//Pixels color objects

	$php5= ((int)PHP_VERSION >= 5)? TRUE : FALSE;

	if($php5)date_default_timezone_set('America/New_York');							//Set as needed, php5.1+

	$text= 'Image created and saved: ' . date('j M Y h:i A');
	$width= 	940;
	$height= 	85;
	$font_size= 	32;
	$left_margin=	30;
	$top_margin=	55;													//Text and shadow location
	$label_img=	'./test_label.jpg';

	$color->setColor('skyblue');
	$obj2->newImage($width, $height, $color);									//Create the label image

	$draw->setFont("Bookman-DemiItalic");										//Set the font
	$draw->setFontSize($font_size);											   //Set the size

	$color->setColor("black");                                                                                              //Shadow color
	$draw->setFillColor($color);

	$obj2->annotateImage($draw, $left_margin+5, $top_margin+5, 0, $text);			       //Add the text shadow

	$obj2->gaussianBlurImage(0, 6); 										  //Blur it

	$color->setColor("darkred");												//Text color
	$draw->setFillColor($color);
	$color->setColor('magenta');												//Stroke color
	$draw->setStrokeColor($color);

	$draw->annotation($left_margin, $top_margin, $text);							//Add pretty text

	$obj2->drawImage($draw);											//Add the text layer

/********* 3d Frame it ********************************/
/*
 * The IM command:  -mattecolor Blue -frame 10x10+0+6
*/

 	$color->setColor('blue');

 	$obj2->frameImage($color, 14, 14, 0, 8);

	$obj2->SetImageFormat('jpeg');

	$obj2->writeImage($label_img);

	$report .= "<img alt=\"image missing\" src=\"$label_img\">\n\n";

        $report .= "</body></html>\n\n";

        echo $report;