Echoing Image using PHP problem
Posted: 2010-02-25T03:56:40-07:00
Hi all. I am using the following to echo an image but i think it is not the best way
The problem is that i dont know how to simply echo the image
I have used
header( 'Content-Type: image/jpeg' );
MagickEchoImageBlob( $resource );
But it dosnt seem to work. Btw just to let you know I am getting the images as part of a sequence of images, resizing them and then displaying them - I dont want a load of extra images made and saved on my server though so I just want something like
MagickEchoImageBlob( $resource );
and this to simply show the image. I dont want to use
header( 'Content-Type: image/jpeg' );
any help would be greaT!!
Code: Select all
$resource = NewMagickWand();
MagickReadImage( $resource, $showpics );
$resource = MagickTransformImage( $resource, '0x0', '300x300' );
$width = MagickGetImageWidth( $resource );
$height = MagickGetImageHeight( $resource );
$newheight = ($height/2/2);
$newwidth = ($width/2/2);
MagickCropImage( $resource, 150, 120, $newwidth, $newheight );
$src_file = 'imagesresized/'.$showpics;
MagickWriteImage($resource, $src_file);
echo'<img src="imagesresized/'.$showpics.'" />';
The problem is that i dont know how to simply echo the image
I have used
header( 'Content-Type: image/jpeg' );
MagickEchoImageBlob( $resource );
But it dosnt seem to work. Btw just to let you know I am getting the images as part of a sequence of images, resizing them and then displaying them - I dont want a load of extra images made and saved on my server though so I just want something like
MagickEchoImageBlob( $resource );
and this to simply show the image. I dont want to use
header( 'Content-Type: image/jpeg' );
any help would be greaT!!