Page 1 of 1

Echo Image?!?!?

Posted: 2010-09-13T08:58:05-07:00
by ccdan
Completely new to imagemagick and magickwand and want to convert a gallery script I made to resize the large view images into thumbnails when building whatever specific gallery. Issue I have is simply lack of documentation on magickwand to figure out how to output the image on the page after resizing and cropping it. I got a single image to work using Blob but since I need to header the page "image/jpeg" the rest of the html on the page and vise versa won't show up.

Here's what I would like to do...

<?php //
$currentimage = "img/01.jpg";

$resource = NewMagickWand();
MagickReadImage( $resource, $currentimage );

$resource = MagickTransformImage( $resource, '0x0', '100x100' );
MagickCropImage( $resource, 100, 60, 0, 0 );

header( 'Content-Type: image/jpeg' );

echo '<a href="$currentimage">';
MagickEchoImageBlob( $resource );
echo '</a>';

?>

So resize and crop the image and display as a link to the original full size image.

Anyone help me with this issue or guide in in the correct direction to do what I want?

Thanks,
DAn

Re: Echo Image?!?!?

Posted: 2010-09-13T12:03:53-07:00
by mlin@pelmorex.com
Not a php expertise, but you can try:
<?php //
$currentimage = "img/01.jpg";

$resource = NewMagickWand();
MagickReadImage( $resource, $currentimage );

$resource = MagickTransformImage( $resource, '0x0', '100x100' );
MagickCropImage( $resource, 100, 60, 0, 0 );
imagejpeg($resource);
?>