1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-07-24 18:21:48 +02:00

Changing CImage::output() as proposed in #37.

This commit is contained in:
Mikael Roos
2014-11-21 20:20:35 +01:00
parent 78ac29752e
commit c83eac8c3c
2 changed files with 8 additions and 4 deletions

View File

@@ -1547,10 +1547,8 @@ class CImage
$this->log("Outputting image: $file");
// Get details on image
$info = list($width, $height, $type, $attr) = getimagesize($file);
!empty($info) or $this->raiseError("The file doesn't seem to be an image.");
$mime = $info['mime'];
// Get image modification time
clearstatcache();
$lastModified = filemtime($file);
$gmdate = gmdate("D, d M Y H:i:s", $lastModified);
@@ -1576,6 +1574,11 @@ class CImage
exit;
}
// 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);
readfile($file);
}

View File

@@ -133,6 +133,7 @@ Revision history
v0.5.x (latest)
* Changing `CImage::output()` as proposed in #37.
* Adding security check that image filename is always below the path `image_path` as specified in `img_config.php` #37.
* Adding configuration item in `img_config.php` for setting valid characters in image filename.
* Moving `webroot/test*` into directory `webroot/test`.