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

correcting filenaming in cache dir

This commit is contained in:
Mikael Roos
2012-10-02 23:40:32 +02:00
parent 9e3c7fae82
commit 0998f2819e
2 changed files with 17 additions and 4 deletions

View File

@@ -88,7 +88,7 @@ class CImage {
} }
} }
$subdir = str_replace('/', '-', dirname($this->imageName)); $subdir = str_replace('/', '-', dirname($this->imageName));
$subdir = '.' ? '_.' : $subdir; $subdir = ($subdir == '.') ? '_.' : $subdir;
return $this->saveFolder . '/' . $subdir . '_' . $parts['filename'] . '_' . round($this->newWidth) . '_' . round($this->newHeight) . $crop . $cropToFit . $crop_x . $crop_y . $quality . $filters . '.' . $parts['extension']; return $this->saveFolder . '/' . $subdir . '_' . $parts['filename'] . '_' . round($this->newWidth) . '_' . round($this->newHeight) . $crop . $cropToFit . $crop_x . $crop_y . $quality . $filters . '.' . $parts['extension'];
} }

View File

@@ -4,9 +4,9 @@ Image conversion on the fly using PHP
About About
------------------------------------- -------------------------------------
The `CImage.php` is a PHP class that can resize and crop images on the fly and output The `CImage.php` is a PHP class that can resize and crop images on the fly on the server side
them to, for example to a webpage. The class preserves a cache of the generated images and output them to, for example to a webpage. The class preserves a cache of the generated
and responds with HTTP 304 (not modified) if the image has not changed. images and responds with HTTP 304 (not modified) if the image has not changed.
The file `img.php` uses `CImage.php` to resize images. It is a usecase on how to use The file `img.php` uses `CImage.php` to resize images. It is a usecase on how to use
the class. `img.php` is useful for webpages which want to dynamically resize the images. the class. `img.php` is useful for webpages which want to dynamically resize the images.
@@ -64,6 +64,17 @@ center of the image from which the crop is done.
* Support for resizing opaque images. * Support for resizing opaque images.
* Clean up code in `CImage.php`. * Clean up code in `CImage.php`.
v0.4 (latest)
* Nothing yet.
v0.31 (2012-10-02)
* Corrected error on naming cache-files using subdir.
v0.3 (2012-10-02) v0.3 (2012-10-02)
* Added crop. Can crop a area (`width`, `height`, `start_x`, `start_y`) from the original * Added crop. Can crop a area (`width`, `height`, `start_x`, `start_y`) from the original
@@ -72,6 +83,7 @@ image.
* Pre-defined sizes can be configured for width in `img.php`. * Pre-defined sizes can be configured for width in `img.php`.
* Corrected to make crop work with width or height in combination with crop-to-fit. * Corrected to make crop work with width or height in combination with crop-to-fit.
v0.2 (2012-05-09) v0.2 (2012-05-09)
* Implemented filters as in http://php.net/manual/en/function.imagefilter.php * Implemented filters as in http://php.net/manual/en/function.imagefilter.php
@@ -80,6 +92,7 @@ v0.2 (2012-05-09)
* Added quality-setting. * Added quality-setting.
* Added testcases for above. * Added testcases for above.
v0.1.1 (2012-04-27) v0.1.1 (2012-04-27)
* Corrected calculation where both width and height were set. * Corrected calculation where both width and height were set.