PHP

HOW TO READ & DISPLAY IMAGE IN PHP

GET IMAGE INFO $file = "cate.jpg"; $fileData = exif_read_data($file);

PHP OUTPUT IMAGE

01

OUTPUT IMAGE header("Content-Type: " . $fileData['MimeType']); header("Content-Length: " . $fileData['FileSize']);   readfile($file);

POINT IMAGE TO ABOVE PHP <img src="SCRIPT.PHP"/>

READ IMAGE INFO $file = "cate.jpg"; $data = exif_read_data($file); $encode = base64_encode (file_get_contents($file));

BASE64 ENCODED IMAGE

02

BASE 64 ENCODED IMAGE echo "<img src=\"data:${data ["MimeType"]};base64,${encode}\"/>";