Echo Image?!?!?

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
ccdan

Echo Image?!?!?

Post 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
mlin@pelmorex.com

Re: Echo Image?!?!?

Post 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);
?>
Post Reply