diff --git a/public/media.php b/public/media.php index 9c10c91..6a5cbc0 100644 --- a/public/media.php +++ b/public/media.php @@ -1,6 +1,14 @@ 0 && strpos($filepath, 'uploads/') === 0 && is_file($filepath)) { + $image = imagecreatefromstring(file_get_contents($filepath)); $newWidth = (isset($_GET['w']) ? intval($_GET['w']) : -1); $newHeight = (isset($_GET['h']) ? intval($_GET['h']) : -1); @@ -39,8 +47,8 @@ if (isset($_GET['url']) && strpos($_GET['url'], 'uploads/') === 0 && is_file($_G imagedestroy($newImage); } else { // Output the original image to the browser - header('Content-Type: '. mime_content_type($_GET['url'])); - readfile($_GET['url']); + header('Content-Type: '. mime_content_type($filepath)); + readfile($filepath); } // Clean up the image resources