1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-06 08:07:42 +02:00

webroot/img/issue117/img.php?src=issue117%2Ftri_original.png

This commit is contained in:
Mikael Roos
2015-10-21 00:05:14 +02:00
parent 7c0f37628f
commit ca9b4a4ce6
3 changed files with 16 additions and 9 deletions

View File

@@ -1438,19 +1438,19 @@ class CImage
throw new Exception("Could not load image."); throw new Exception("Could not load image.");
} }
/* Removed v0.7.7
if (image_type_to_mime_type($this->fileType) == 'image/png') { if (image_type_to_mime_type($this->fileType) == 'image/png') {
$type = $this->getPngType(); $type = $this->getPngType();
$hasFewColors = imagecolorstotal($this->image); $hasFewColors = imagecolorstotal($this->image);
/* Removed v0.7.7
if ($type == self::PNG_RGB_PALETTE || ($hasFewColors > 0 && $hasFewColors <= 256)) { if ($type == self::PNG_RGB_PALETTE || ($hasFewColors > 0 && $hasFewColors <= 256)) {
if ($this->verbose) { if ($this->verbose) {
$this->log("Handle this image as a palette image."); $this->log("Handle this image as a palette image.");
} }
$this->palette = true; $this->palette = true;
} }
*/
} }
*/
if ($this->verbose) { if ($this->verbose) {
$this->log("### Image successfully loaded from file."); $this->log("### Image successfully loaded from file.");
@@ -2276,10 +2276,11 @@ class CImage
*/ */
protected function getTargetImageExtension() protected function getTargetImageExtension()
{ {
// switch on mimetype
if (isset($this->extension)) { if (isset($this->extension)) {
return strtolower($this->extension); return strtolower($this->extension);
} else { } else {
return image_type_to_extension($this->fileType); return substr(image_type_to_extension($this->fileType), 1);
} }
} }
@@ -2308,7 +2309,9 @@ class CImage
is_writable($this->saveFolder) is_writable($this->saveFolder)
or $this->raiseError('Target directory is not writable.'); or $this->raiseError('Target directory is not writable.');
switch($this->getTargetImageExtension()) { $type = $this->getTargetImageExtension();
$this->Log("Saving image as " . $type);
switch($type) {
case 'jpeg': case 'jpeg':
case 'jpg': case 'jpg':
@@ -2402,8 +2405,6 @@ class CImage
return $this; return $this;
} }
$alias = $alias . "." . $this->getTargetImageExtension();
if (is_readable($alias)) { if (is_readable($alias)) {
unlink($alias); unlink($alias);
} }
@@ -2538,6 +2539,10 @@ class CImage
$details['memoryCurrent'] = round(memory_get_usage()/1024/1024, 3) . " MB"; $details['memoryCurrent'] = round(memory_get_usage()/1024/1024, 3) . " MB";
$details['memoryLimit'] = ini_get('memory_limit'); $details['memoryLimit'] = ini_get('memory_limit');
if (isset($_SERVER['REQUEST_TIME_FLOAT'])) {
$details['loadTime'] = (string) round((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']), 3) . "s";
}
if ($details['mimeType'] == 'image/png') { if ($details['mimeType'] == 'image/png') {
$details['pngType'] = $this->getPngTypeAsString(null, $file); $details['pngType'] = $this->getPngTypeAsString(null, $file);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -13,6 +13,7 @@ return array(
* Default values: * Default values:
* mode: 'production' * mode: 'production'
*/ */
'mode' => 'development', // 'development', 'strict'
//'mode' => 'production', // 'development', 'strict' //'mode' => 'production', // 'development', 'strict'
@@ -110,7 +111,8 @@ return array(
/** /**
* The name representing a dummy image which is automatically created * The name representing a dummy image which is automatically created
* and stored at the defined path. * and stored at the defined path. The dummy image can then be used
* inplace of an original image as a placeholder.
* The dummy_dir must be writable and it defaults to a subdir of the * The dummy_dir must be writable and it defaults to a subdir of the
* cache directory. * cache directory.
* Write protect the dummy_dir to prevent creation of new dummy images, * Write protect the dummy_dir to prevent creation of new dummy images,