mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-07 16:46:39 +02:00
Adding save-as as part of the generated cache filename, #121.
This commit is contained in:
25
CImage.php
25
CImage.php
@@ -600,6 +600,26 @@ class CImage
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize the file extension.
|
||||||
|
*
|
||||||
|
* @param string $extension of image file or skip to use internal.
|
||||||
|
*
|
||||||
|
* @return string $extension as a normalized file extension.
|
||||||
|
*/
|
||||||
|
private function normalizeFileExtension($extension = null)
|
||||||
|
{
|
||||||
|
$extension = strtolower($extension ? $extension : $this->extension);
|
||||||
|
|
||||||
|
if ($extension == 'jpeg') {
|
||||||
|
$extension = 'jpg';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $extension;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download a remote image and return path to its local copy.
|
* Download a remote image and return path to its local copy.
|
||||||
*
|
*
|
||||||
@@ -1279,6 +1299,9 @@ class CImage
|
|||||||
$rotateBefore = $this->rotateBefore ? "_rb{$this->rotateBefore}" : null;
|
$rotateBefore = $this->rotateBefore ? "_rb{$this->rotateBefore}" : null;
|
||||||
$rotateAfter = $this->rotateAfter ? "_ra{$this->rotateAfter}" : null;
|
$rotateAfter = $this->rotateAfter ? "_ra{$this->rotateAfter}" : null;
|
||||||
|
|
||||||
|
$saveAs = $this->normalizeFileExtension();
|
||||||
|
$saveAs = $saveAs ? "_$saveAs" : null;
|
||||||
|
|
||||||
$width = $this->newWidth;
|
$width = $this->newWidth;
|
||||||
$height = $this->newHeight;
|
$height = $this->newHeight;
|
||||||
|
|
||||||
@@ -1336,7 +1359,7 @@ class CImage
|
|||||||
. $quality . $filters . $sharpen . $emboss . $blur . $palette
|
. $quality . $filters . $sharpen . $emboss . $blur . $palette
|
||||||
. $optimize . $compress
|
. $optimize . $compress
|
||||||
. $scale . $rotateBefore . $rotateAfter . $autoRotate . $bgColor
|
. $scale . $rotateBefore . $rotateAfter . $autoRotate . $bgColor
|
||||||
. $convolve;
|
. $convolve . $saveAs;
|
||||||
|
|
||||||
return $this->setTarget($file, $base);
|
return $this->setTarget($file, $base);
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,8 @@ Revision history
|
|||||||
v0.7.6* (2015-10-20)
|
v0.7.6* (2015-10-20)
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
* Add extra fileds to json-response, #114.
|
* Adding save-as as part of the generated cache filename, #121.
|
||||||
|
* Add extra fields to json-response, #114.
|
||||||
* Add header for Content-Length, #111.
|
* Add header for Content-Length, #111.
|
||||||
* Add check for postprocessing tools in path in `webroot/check_system.php`, #104.
|
* Add check for postprocessing tools in path in `webroot/check_system.php`, #104.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user