X-Git-Url: https://git.jacobcasper.com/?p=pics.git;a=blobdiff_plain;f=pic.php;fp=pic.php;h=ece33b99dd998a2b4981388771005ce6820d4882;hp=0000000000000000000000000000000000000000;hb=fd25bf8779a37e731732f3978f5cef80704f00f9;hpb=a00830238460484a90109473d974f6acb87eb121 diff --git a/pic.php b/pic.php new file mode 100644 index 0000000..ece33b9 --- /dev/null +++ b/pic.php @@ -0,0 +1,27 @@ +prepare('SELECT + pi.ID, pi.MIME_TYPE, pi.PIC_B64 + FROM pics pi + WHERE pi.ID = :id'); + $fetch_stmt->bindValue(':id', $id); + $result = $fetch_stmt->execute(); + if ($pic = $result->fetchArray()) { + $mime_type = $pic['MIME_TYPE']; + $file_b64 = $pic['PIC_B64']; + $pic_id = $pic['ID']; + header("Content-Type: {$mime_type}"); + die(base64_decode($file_b64, true)); + } + header('HTTP/1.0 404 Not Found'); + die('404 File Not Found'); +?>