Working with php image resources

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
mordisko

Working with php image resources

Post by mordisko » 2008-06-11T01:13:36-07:00

Hello everyone!
I just downloaded an installed my imagemagick+magickwand and was toying a little with it. It's very hard to learn it due to the lack of tutorials =(

I found a limitation wich will make my job harder and it's that imagemagick does not seem to be able to work with php image resources (or at least i don't know how). Is there any way that a magickwand can read -and understand- an image resource created from php gd? let's say, for example, and imagecreatefromjpeg().

I've seen that you can work with blobs or files, but i did not find a way to do this.
Any help will be very appreciated.

Thanks a lot
Mordisko

EDIT: mispelling (my english is terrible!)

Romain

Re: Working with php image resources

Post by Romain » 2008-06-12T07:33:36-07:00

I am learning as well, and this tutorial helps me a lot along with the documentation:
http://www.ioncannon.net/php/61/php-ima ... -examples/

umitdogan

Re: Working with php image resources

Post by umitdogan » 2008-06-20T01:00:23-07:00

Hi,
There is no resource on the web. I have spent long hours but got no information.
I need to work with transparent images. But I had lots of unsolved problems. I am planning to change my direction.
The worst documented project I have ever seen :(

mordisko

Re: Working with php image resources

Post by mordisko » 2008-06-20T05:14:04-07:00

Well, it's not the topic of the post but maybe this can help you. I needed a code to shear an image and let it in a transparent background and i ended with this (it's part of a class so maybe some things make no sense, just ignore them). The point is to use the pixelwand as 'transparent' and convert the image to a type you can handle.

Code: Select all

		function perspectiva($imagen='',$x=0,$y=0) {
			if (!$imagen&&!$imagen=$this->Fichero)
				return false;
		
			$wand=NewMagickWand();	
			MagickReadImage($wand,$imagen);
			$pixel=NewPixelWand();
			PixelSetColor($pixel,"transparent");
			MagickSetImageFormat($wand,"PNG");
			MagickShearImage($wand,$pixel,$x,$y);
			MagickEchoImageBlob($wand);
			return true;
		}
Hope this helps you a little.

Post Reply