Imagick View the Output

Hi E's, The code in snippet code put a watermark in a image, the problem is I can't see the picture when I execute the script:
in practice:
File index.php contain the code in snippet code.
For I see the picture created by index.php script I create the file mostra.php with this contain
=====================
<img src="index.php" />
=====================
When I execute the file mostra.php, the browser don't show the picture, don't show anything.

What I do wrong?
What is the best way to see the result of index.php?

Regards, JC
<?php
/* Create Imagick object */
$im = new Imagick( 'imagem.jpg' );
/* Create a drawing object and set the font size */
$draw = new ImagickDraw();
$draw->setFontSize( 30 );    
/* Make the watermark semi-transparent */
$draw->setFillAlpha( 0.4 );
/* Set gravity to the center. More about gravity: 
http://www.imagemagick.org/Usage/annotating/#gravity */
$draw->setGravity( Imagick::GRAVITY_CENTER );
/* Write the text on the image
Position x0,y0 (Because gravity is set to center)
Rotation 45 degrees.
*/
$im->annotateImage( $draw, 0, 0, 45, "Copyright" );
/* Output */
header( "Content-Type: image/{$im->getImageFormat()}" );
echo $im;
?>

Open in new window

LVL 4
Pedro ChagasWebmasterAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

karoldvlCommented:
Try changing line 19:
echo $im;

to:
echo $im->getImageBlob();

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.