Setareh Afshari
Setareh Afshari

Reputation: 29

Some code shows as picture in php with Imagemagick

I use imagemagick to show picture in php by this code:

$img=new Imagick('C:/xampp/htdocs/img/core.png');
echo $img;

Instead of showing picture I see some code in browser like this:

w�zƿ�sr3���������)I0�C���۱�

How can I fix this?

Upvotes: 0

Views: 61

Answers (1)

user557846
user557846

Reputation:

You need to tell the browser you issuing and image first and add the appropriate headers:

header('Content-type: image/png');
echo $image;

Upvotes: 2

Related Questions