From 553d2f3db141a3d1fa5ab0ce6c2c570f19885087 Mon Sep 17 00:00:00 2001 From: Mikael Roos Date: Sun, 18 Oct 2015 18:34:42 +0200 Subject: [PATCH] Add header for Content-Length, #111. --- CImage.php | 18 +++++++++++------- REVISION.md | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CImage.php b/CImage.php index 5a1f09b..aa84013 100644 --- a/CImage.php +++ b/CImage.php @@ -2366,8 +2366,16 @@ class CImage } else { + // Get details on image + $info = getimagesize($file); + !empty($info) or $this->raiseError("The file doesn't seem to be an image."); + $mime = $info['mime']; + $size = filesize($file); + if ($this->verbose) { - $this->log("Last modified: " . $gmdate . " GMT"); + $this->log("Last-Modified: " . $gmdate . " GMT"); + $this->log("Content-type: " . $mime); + $this->log("Content-length: " . $size); $this->verboseOutput(); if (is_null($this->verboseFileName)) { @@ -2375,12 +2383,8 @@ class CImage } } - // Get details on image - $info = getimagesize($file); - !empty($info) or $this->raiseError("The file doesn't seem to be an image."); - $mime = $info['mime']; - - header('Content-type: ' . $mime); + header("Content-type: $mime"); + header("Content-length: $size"); readfile($file); } diff --git a/REVISION.md b/REVISION.md index d202786..13dbd91 100644 --- a/REVISION.md +++ b/REVISION.md @@ -8,6 +8,7 @@ Revision history v0.7.6* (2015-10-18) ------------------------------------- +* Add header for Content-Length, #111. * Add check for postprocessing tools in path in `webroot/check_system.php`, #104.