X-Git-Url: https://git.jacobcasper.com/?p=pics.git;a=blobdiff_plain;f=app.php;fp=app.php;h=a3f259738f31429117fcfdca5332c596f2e7a032;hp=0000000000000000000000000000000000000000;hb=bcb1d27e0e85299038af134ff027ff75d4bf1e58;hpb=ac20a7ef113b0e901e15ae674c1394d424327fb2 diff --git a/app.php b/app.php new file mode 100644 index 0000000..a3f2597 --- /dev/null +++ b/app.php @@ -0,0 +1,41 @@ + + + + + + + +
+Upload +query('SELECT + p.ID, p.TIMESTAMP, pi.MIME_TYPE, pi.PIC_B64, c.BODY + FROM posts p + JOIN pics pi on p.id = pi.post_id + JOIN comments c on p.id = c.post_id + ORDER BY p.TIMESTAMP DESC'); +while ($post = $posts->fetchArray()) { + $mime_type = $post['MIME_TYPE']; + $file_b64 = $post['PIC_B64']; + $post_id = $post['ID']; + $comment_text = $post['BODY']; + $img = new Imagick(); + $img->readImageBlob(base64_decode($file_b64)); + $img->setImageCompressionQuality(85); + $img->adaptiveResizeImage(480, 0); + $compressed_b64 = base64_encode($img->getImageBlob()); + + echo "
"; + + echo "$"; + echo "

{$comment_text}

"; + echo '
'; +} +?> +
+ +