From: Tim Düsterhus Date: Tue, 16 Aug 2016 18:18:31 +0000 (+0200) Subject: Redirect to static image in ImageProxyAction X-Git-Tag: 3.0.0_Beta_1~725 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1a01691b8d9618c9900ddc488ba98c8636fbf198;p=GitHub%2FWoltLab%2FWCF.git Redirect to static image in ImageProxyAction This reduces load in case some use tries to be funny and directly request ImageProxyAction over and over and over again. --- diff --git a/wcfsetup/install/files/lib/action/ImageProxyAction.class.php b/wcfsetup/install/files/lib/action/ImageProxyAction.class.php index e7c43e541d..7cb064bb15 100644 --- a/wcfsetup/install/files/lib/action/ImageProxyAction.class.php +++ b/wcfsetup/install/files/lib/action/ImageProxyAction.class.php @@ -47,7 +47,8 @@ class ImageProxyAction extends AbstractAction { // prepare path $fileExtension = pathinfo($url, PATHINFO_EXTENSION); - $fileLocation = WCF_DIR.'images/proxy/'.substr($fileName, 0, 2).'/'.$fileName.($fileExtension ? '.'.$fileExtension : ''); + $path = 'images/proxy/'.substr($fileName, 0, 2).'/'.$fileName.($fileExtension ? '.'.$fileExtension : ''); + $fileLocation = WCF_DIR.$path; $dir = dirname($fileLocation); if (!@file_exists($dir)) { FileUtil::makePath($dir); @@ -76,13 +77,9 @@ class ImageProxyAction extends AbstractAction { // update mtime for correct expiration calculation @touch($fileLocation); } - else { - $imageData = getimagesize($fileLocation); - } $this->executed(); - @header('Content-Type: '.$imageData['mime']); - @readfile($fileLocation); + HeaderUtil::redirect(WCF::getPath().$path, true, false); exit; } catch (SystemException $e) {