vendredi 17 avril 2015

Error when displaying image in PHP

I'm trying to understand how the file systems work in PHP. I created a small example to display an image from a folder but instead of printing the image I think I'm printing the contents.



<?php
$image = "/path/to/image.jpg";
$myfile = fopen($image, "r") or die("Unable to open file!");

$logo = fread($myfile,filesize($image));
echo"<img src=\"$logo\" width=\"100\" height=\"100\"\/>";
?>


Did I happen to write a command wrong or miss something I needed to do?


Aucun commentaire:

Enregistrer un commentaire