From: Banana Date: Mon, 26 Jul 2021 14:50:52 +0000 (+0200) Subject: added something to display images X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=80b108c2de18a6d892121ce3f56762224453b38a;p=selfpaste.git added something to display images --- diff --git a/webroot/index.php b/webroot/index.php index 2f252e7..c18d715 100644 --- a/webroot/index.php +++ b/webroot/index.php @@ -79,6 +79,14 @@ if(!empty($_short)) { $_requestFile .= $_p; $_requestFile .= $_t; if(is_readable($_requestFile)) { + + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $mime = finfo_file($finfo, $_requestFile); + finfo_close($finfo); + if(strstr($mime,'image/')) { + $contentType = "Content-type: $mime;"; + } + $contentBody = $_requestFile; $httpResponseCode = 200; }