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:
11
CImage.php
11
CImage.php
@@ -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);
|
||||
}
|
||||
|
@@ -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`.
|
||||
|
Reference in New Issue
Block a user