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

Adding save-as as part of the generated cache filename, #121.

This commit is contained in:
Mikael Roos
2015-10-20 10:26:09 +02:00
parent 37b39fbecf
commit f721ef4b35
2 changed files with 26 additions and 2 deletions

View File

@@ -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.
*
@@ -1279,6 +1299,9 @@ class CImage
$rotateBefore = $this->rotateBefore ? "_rb{$this->rotateBefore}" : null;
$rotateAfter = $this->rotateAfter ? "_ra{$this->rotateAfter}" : null;
$saveAs = $this->normalizeFileExtension();
$saveAs = $saveAs ? "_$saveAs" : null;
$width = $this->newWidth;
$height = $this->newHeight;
@@ -1336,7 +1359,7 @@ class CImage
. $quality . $filters . $sharpen . $emboss . $blur . $palette
. $optimize . $compress
. $scale . $rotateBefore . $rotateAfter . $autoRotate . $bgColor
. $convolve;
. $convolve . $saveAs;
return $this->setTarget($file, $base);
}

View File

@@ -8,7 +8,8 @@ Revision history
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 check for postprocessing tools in path in `webroot/check_system.php`, #104.