1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-05 15:47:30 +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.");
}
/* Removed v0.7.7
if (image_type_to_mime_type($this->fileType) == 'image/png') {
$type = $this->getPngType();
$hasFewColors = imagecolorstotal($this->image);
/* Removed v0.7.7
if ($type == self::PNG_RGB_PALETTE || ($hasFewColors > 0 && $hasFewColors <= 256)) {
if ($this->verbose) {
$this->log("Handle this image as a palette image.");
}
$this->palette = true;
}
*/
}
*/
if ($this->verbose) {
$this->log("### Image successfully loaded from file.");
@@ -2276,10 +2276,11 @@ class CImage
*/
protected function getTargetImageExtension()
{
// switch on mimetype
if (isset($this->extension)) {
return strtolower($this->extension);
} 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)
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 'jpg':
@@ -2402,8 +2405,6 @@ class CImage
return $this;
}
$alias = $alias . "." . $this->getTargetImageExtension();
if (is_readable($alias)) {
unlink($alias);
}
@@ -2534,9 +2535,13 @@ class CImage
$details['size'] = filesize($file);
$details['colors'] = $this->colorsTotal($this->image);
$details['includedFiles'] = count(get_included_files());
$details['memoryPeek'] = round(memory_get_peak_usage()/1024/1024, 3) . " MB" ;
$details['memoryPeek'] = round(memory_get_peak_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') {
$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:
* mode: 'production'
*/
'mode' => 'development', // 'development', 'strict'
//'mode' => 'production', // 'development', 'strict'
@@ -110,7 +111,8 @@ return array(
/**
* 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
* cache directory.
* Write protect the dummy_dir to prevent creation of new dummy images,