1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-04-21 17:31:58 +02:00

Fixed issue 1 and prepare to tagg v0.4.1

This commit is contained in:
Mikael Roos 2014-01-27 13:19:07 +01:00
parent 230e9189a3
commit 28f3c55d8c
2 changed files with 4 additions and 7 deletions

View File

@ -40,8 +40,6 @@ class CImage {
private $quality;
public $filters;
public $saveFolder;
public $newName;
//private $newFileName; // OBSOLETE, using cacheFileName instead.
private $mime; // Calculated from source image
private $width; // Calculated from source image
private $height; // Calculated from source image
@ -71,16 +69,14 @@ class CImage {
* @param string $imageName filename which may contain subdirectory.
* @param string $imageFolder path to root folder for images.
* @param string $saveFolder path to folder where to save the new file or null to skip saving.
* @param string $newName new filename or leave to null to autogenerate filename.
*/
public function __construct($imageName=null, $imageFolder=null, $saveFolder=null, $newName=null) {
public function __construct($imageName=null, $imageFolder=null, $saveFolder=null) {
$this->imageName = ltrim($imageName, '/');
$this->imageFolder = rtrim($imageFolder, '/');
$this->pathToImage = $this->imageFolder . '/' . $this->imageName;
$this->fileExtension = pathinfo($this->pathToImage, PATHINFO_EXTENSION);
$this->extension = $this->fileExtension;
$this->saveFolder = $saveFolder;
$this->newName = $newName;
}

View File

@ -60,7 +60,7 @@ Usage
| `nr, no-ratio, stretch` | Do *not* keep aspect ratio when resizing using both width & height constraints. Results in stretching the image, if needed, to fit in the resulting box. |
| `cf, crop-to-fit` | Set together with both `h` & `w` to make the image fit into dimensions, and crop out the rest of the image. |
| `a, area` | Define the area of the image to work with. Set `area=10,10,10,10` (top,right,bottom,left) to crop out the 10% of the outermost area. It works like an offset to define which part of the image you want to process. Its an alternative to use `crop`. |
| `c, crop` | Crops an area from the original image, set width, height, start_x and start_y to define the area to crop, for example `crop=100,100,10,10` (`crop=width,height,start_x,start_y`). Left top corner is 0, 0. You can use left, right or center when setting start_x. You may use top, bottom or center when setting start_y. Use 0 for width or height to get the width/height of the original image. Use negative values for width/height to get original width/height minus selected value. |
| `c, crop` | Crops an area from the original image, set width, height, start_x and start_y to define the area to crop, for example `crop=100,100,10,10` (`crop=width,height,start_x,start_y`). Left top corner is 0, 0. You can use left, right or center when setting start_x. You may use top, bottom or center when setting start_y. You can use negative values for x and y. Use 0 for width or height to get the width/height of the original image. Use negative values for width/height to get original width/height minus selected value. |
| `q, quality` | Quality affects lossy compression and file size for JPEG images by setting the quality between 1-100, default is 60. Quality has no effect on PNG or GIF. |
| `d, deflate` | For PNG images it defines the compression algorithm, values can be 1-9, default is defined by PHP GD. Quality has no effect on JPEG or GIF. |
| `sharpen` | Appy a filter that sharpens the image. |
@ -83,7 +83,7 @@ Combine the parameters to get the desired behavior and resulting image. For exam
Revision history
-------------------------------------
v0.4.x (latest)
v0.4.1 (2014-01-27)
* Changed => to == on Modified-Since.
* Always send Last-Modified-Header.
@ -92,6 +92,7 @@ v0.4.x (latest)
* Fixed crop whole image by setting crop=0,0,0,0
* Use negative values for crop width & height to base calulation on original width/height and withdraw selected amount.
* Correcting jpeg when setting quality.
* Removed obsolete reference to `$newName` in `CImage::__construct()` (issue 1).
v0.4 (2013-10-08)