1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-05-06 01:05:17 +02:00

testing before release v0.7.0

This commit is contained in:
Mikael Roos 2015-02-02 12:39:58 +01:00
parent 16a7a3dad5
commit c012cb2537
8 changed files with 243 additions and 203 deletions

@ -313,7 +313,7 @@ class CRemoteImage
*/
public function loadCacheDetails()
{
$cacheFile = str_replace(["/", ":", "#", ".", "?"], "-", $this->url);
$cacheFile = str_replace(array("/", ":", "#", ".", "?"), "-", $this->url);
$this->fileName = $this->saveFolder . $cacheFile;
$this->fileJson = $this->fileName . ".json";
if (is_readable($this->fileJson)) {

175
README.md

@ -275,176 +275,7 @@ http://dbwebb.se/opensource/cimage
Revision history
-------------------------------------
v0.6.x (latest)
* Now returns statuscode 500 when something fails #55.
* Three different modes: strict, production, development #44.
* Three files for all-in-one `imgs.php`, `imgp.php`, `imgd.php` #73.
* Change name of script all-in-one to `webroot/imgs.php` #73.
* Combine all code into one singel script, `webroot/img_single.php` #73.
* Disallow hotlinking/leeching by configuration #46.
* Alias-name is without extension #47.
* Option `alias` now requires `password` to work #47.
* Support for option `password, pwd` to protect usage of `alias` and remote download.
* Added support for option `alias` that creates a link to a cached version of the image #47.
* Create cache directory for remote download if it does not exists.
* Cleaned up `img_config.php` and introduced default values for almost all options #72.
v0.6.2 (2015-01-14)
* Added support for download of remote images #43.
* Added autoloader.
v0.6.1 (2015-01-08)
* Adding compare-page for comparing images. Issue #20.
* Added option `no-upscale, nu` as resizing strategy to decline upscaling of smaller images. Fix #61.
* Minor change in `CImage::resize()`, crop now does imagecopy without resamling.
* Correcting internal details for save-as and response json which indicated wrong colors. Fix #62.
* Fixed fill-to-fit that failed when using aspect-ratio. Fix #52.
* JSON returns correct values for resulting image. Fix #58.
* Corrected behaviour for skip-original. Fix #60.
v0.6 (2014-12-06)
* Rewrote and added documentation.
* Moved conolution expressesion from `img_config.php` to `CImage`.
* Minor cleaning of properties in `CImage`. Fix #23.
* Adding `webroot/htaccess` to show off how friendly urls can be created for `img.php`. Fix #45.
* Added option `fill-to-fit, ff`. Fix #38.
* Added option `shortcut, sc` to enable configuration of complex expressions. Fix #2.
* Added support for custom convolutions. Fix #49.
* Restructured testprograms. Fix #41.
* Corrected json on PHP 5.3. Fix #42.
* Improving template for tests in `webroot/tests` when testing out #40.
* Adding testcase for #40.
* Adding option `convolve` taking comma-separated list of 11 float-values, wraps and exposes `imageconvoluttion()`. #4
* Adding option `dpr, device-pixel-ratio` which defaults to 1. Set to 2 to get a twice as large image. Useful for Retina displays. Basically a shortcut to enlarge the image.
* Adding utility `cache.bash` to ease gathering stats on cache usage. #21
* Cache-directory can now be readonly and serve all cached files, still failing when need to save files. #5
* Cache now uses same file extension as original image #37.
* Can output image as json format using `json` #11.
v0.5.3 (2014-11-21)
* Support filenames of uppercase JPEG, JPG, PNG and GIF, as proposed in #37.
* Changing `CImage::output()` as proposed in #37.
* Adding security check that image filename is always below the path `image_path` as specified in `img_config.php` #37.
* Adding configuration item in `img_config.php` for setting valid characters in image filename.
* Moving `webroot/test*` into directory `webroot/test`.
* `webroot/check_system.php` now outputs if extension for exif is loaded.
* Broke API when `initDimensions()` split into two methods, new `initDimensions()` and `loadImageDetails()`.
* Added `autoRotate, aro` to auto rotate image based on EXIF information.
* Added `bgColor, bgc` to use as backgroundcolor when needing a filler color, for example rotate 45.
* Added `rotateBefore, rb` to rotate image a certain angle before processing.
* Added `rotateAfter, ra` to rotate image a certain angle after processing.
* Cleaned up code formatting, removed trailing spaces.
* Removed @ from opening images, better to display correct warning when failing #34, but put it back again.
* Setting gd.jpeg_ignore_warning to true as default #34.
* `webroot/check_system.php` now outputs version of PHP and GD.
* #32 correctly send 404 header when serving an error message.
* Trying to verify issue #29, but can not.
* Adding structure for testprograms together with, use `webroot/test_issue29.php` as sample.
* Improving code formatting.
* Moving parts of verbose output from img.php to CImage.php.
v0.5.2 (2014-04-01)
* Correcting issue #26 providing error message when not using postprocessing.
* Correcting issue #27 warning of default timezone.
* Removed default $config options in `img.php`, was not used, all configuration should be in `img_config.php`.
* Verified known bug - sharpen acts as blur in PHP 5.5.9 and 5.5.10 #28
v0.5.1 (2014-02-12)
* Display image in README-file.
* Create an empty `cache` directory as part of repo.
v0.5 (2014-02-12)
* Change constant name `CImage::PNG_QUALITY_DEFAULT` to `CImage::PNG_COMPRESSION_DEFAULT`.
* Split JPEG quality and PNG compression, `CImage->quality` and `CImage->compression`
* Changed `img.php` parameter name `d, deflate` to `co, compress`.
* Separating configuration issues from `img.php` to `img_config.php`.
* Format code according to PSR-2.
* Disabled post-processing JPEG and PNG as default.
* This version is supporting PHP 5.3, later versions will require 5.5 or later.
* Using GitHub issue tracking for feature requests and planning.
* Rewrote [the manual](http://dbwebb.se/opensource/cimage).
* Created directory `webroot` and moved some files there.
v0.4.1 (2014-01-27)
* Changed => to == on Modified-Since.
* Always send Last-Modified-Header.
* Added `htmlentities()` to verbose output.
* Fixed support for jpeg, not only jpg.
* 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)
* Improved support for pre-defined sizes.
* Adding grid column size as predefined size, c1-c24 for a 24 column grid. Configure in `img.php`.
* Corrected error on naming cache-files using subdir.
* Corrected calculation error on width & height for crop-to-fit.
* Adding effects for sharpen, emboss and blur through imageconvolution using matrixes.
* crop-to-fit, add parameter for offset x and y to enable to define which area is the, implemented as area.
* Support for resizing opaque images.
* Center of the image from which the crop is done. Improved usage of area to crop.
* Added support for % in width & height.
* Added aspect-ratio.
* Added scale.
* Quality for PNG images is now knows as deflate.
* Added palette to create images with max 256 colors.
* Added usage of all parameters to README.md
* Added documentation here http://dbwebb.se/opensource/cimage
* Adding `.gitignore`
* Re-adding `cache` directory
v0.3 (2012-10-02)
* Added crop. Can crop a area (`width`, `height`, `start_x`, `start_y`) from the original
image.
* Corrected to make the 304 Not Modified header work.
* Predefined sizes can be configured for width in `img.php`.
* Corrected to make crop work with width or height in combination with crop-to-fit.
v0.2 (2012-05-09)
* Implemented filters as in http://php.net/manual/en/function.imagefilter.php
* Changed `crop` to `crop_to_fit`, works the same way.
* Changed arguments and sends them in array.
* Added quality-setting.
* Added testcases for above.
v0.1.1 (2012-04-27)
* Corrected calculation where both width and height were set.
v0.1 (2012-04-25)
* Initial release after rewriting some older code doing the same, but not that good and flexible.
<pre>
```
.
..: Copyright 2012-2014 by Mikael Roos (me@mikaelroos.se)
</pre>
..: Copyright 2012-2015 by Mikael Roos (me@mikaelroos.se)
```

184
REVISION.md Normal file

@ -0,0 +1,184 @@
Revision history
=====================================
v0.6.x (latest)
-------------------------------------
* Now returns statuscode 500 when something fails #55.
* Three different modes: strict, production, development #44.
* Three files for all-in-one `imgs.php`, `imgp.php`, `imgd.php` #73.
* Change name of script all-in-one to `webroot/imgs.php` #73.
* Combine all code into one singel script, `webroot/img_single.php` #73.
* Disallow hotlinking/leeching by configuration #46.
* Alias-name is without extension #47.
* Option `alias` now requires `password` to work #47.
* Support for option `password, pwd` to protect usage of `alias` and remote download.
* Added support for option `alias` that creates a link to a cached version of the image #47.
* Create cache directory for remote download if it does not exists.
* Cleaned up `img_config.php` and introduced default values for almost all options #72.
v0.6.2 (2015-01-14)
-------------------------------------
* Added support for download of remote images #43.
* Added autoloader.
v0.6.1 (2015-01-08)
-------------------------------------
* Adding compare-page for comparing images. Issue #20.
* Added option `no-upscale, nu` as resizing strategy to decline upscaling of smaller images. Fix #61.
* Minor change in `CImage::resize()`, crop now does imagecopy without resamling.
* Correcting internal details for save-as and response json which indicated wrong colors. Fix #62.
* Fixed fill-to-fit that failed when using aspect-ratio. Fix #52.
* JSON returns correct values for resulting image. Fix #58.
* Corrected behaviour for skip-original. Fix #60.
v0.6 (2014-12-06)
-------------------------------------
* Rewrote and added documentation.
* Moved conolution expressesion from `img_config.php` to `CImage`.
* Minor cleaning of properties in `CImage`. Fix #23.
* Adding `webroot/htaccess` to show off how friendly urls can be created for `img.php`. Fix #45.
* Added option `fill-to-fit, ff`. Fix #38.
* Added option `shortcut, sc` to enable configuration of complex expressions. Fix #2.
* Added support for custom convolutions. Fix #49.
* Restructured testprograms. Fix #41.
* Corrected json on PHP 5.3. Fix #42.
* Improving template for tests in `webroot/tests` when testing out #40.
* Adding testcase for #40.
* Adding option `convolve` taking comma-separated list of 11 float-values, wraps and exposes `imageconvoluttion()`. #4
* Adding option `dpr, device-pixel-ratio` which defaults to 1. Set to 2 to get a twice as large image. Useful for Retina displays. Basically a shortcut to enlarge the image.
* Adding utility `cache.bash` to ease gathering stats on cache usage. #21
* Cache-directory can now be readonly and serve all cached files, still failing when need to save files. #5
* Cache now uses same file extension as original image #37.
* Can output image as json format using `json` #11.
v0.5.3 (2014-11-21)
-------------------------------------
* Support filenames of uppercase JPEG, JPG, PNG and GIF, as proposed in #37.
* Changing `CImage::output()` as proposed in #37.
* Adding security check that image filename is always below the path `image_path` as specified in `img_config.php` #37.
* Adding configuration item in `img_config.php` for setting valid characters in image filename.
* Moving `webroot/test*` into directory `webroot/test`.
* `webroot/check_system.php` now outputs if extension for exif is loaded.
* Broke API when `initDimensions()` split into two methods, new `initDimensions()` and `loadImageDetails()`.
* Added `autoRotate, aro` to auto rotate image based on EXIF information.
* Added `bgColor, bgc` to use as backgroundcolor when needing a filler color, for example rotate 45.
* Added `rotateBefore, rb` to rotate image a certain angle before processing.
* Added `rotateAfter, ra` to rotate image a certain angle after processing.
* Cleaned up code formatting, removed trailing spaces.
* Removed @ from opening images, better to display correct warning when failing #34, but put it back again.
* Setting gd.jpeg_ignore_warning to true as default #34.
* `webroot/check_system.php` now outputs version of PHP and GD.
* #32 correctly send 404 header when serving an error message.
* Trying to verify issue #29, but can not.
* Adding structure for testprograms together with, use `webroot/test_issue29.php` as sample.
* Improving code formatting.
* Moving parts of verbose output from img.php to CImage.php.
v0.5.2 (2014-04-01)
-------------------------------------
* Correcting issue #26 providing error message when not using postprocessing.
* Correcting issue #27 warning of default timezone.
* Removed default $config options in `img.php`, was not used, all configuration should be in `img_config.php`.
* Verified known bug - sharpen acts as blur in PHP 5.5.9 and 5.5.10 #28
v0.5.1 (2014-02-12)
-------------------------------------
* Display image in README-file.
* Create an empty `cache` directory as part of repo.
v0.5 (2014-02-12)
-------------------------------------
* Change constant name `CImage::PNG_QUALITY_DEFAULT` to `CImage::PNG_COMPRESSION_DEFAULT`.
* Split JPEG quality and PNG compression, `CImage->quality` and `CImage->compression`
* Changed `img.php` parameter name `d, deflate` to `co, compress`.
* Separating configuration issues from `img.php` to `img_config.php`.
* Format code according to PSR-2.
* Disabled post-processing JPEG and PNG as default.
* This version is supporting PHP 5.3, later versions will require 5.5 or later.
* Using GitHub issue tracking for feature requests and planning.
* Rewrote [the manual](http://dbwebb.se/opensource/cimage).
* Created directory `webroot` and moved some files there.
v0.4.1 (2014-01-27)
-------------------------------------
* Changed => to == on Modified-Since.
* Always send Last-Modified-Header.
* Added `htmlentities()` to verbose output.
* Fixed support for jpeg, not only jpg.
* 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)
-------------------------------------
* Improved support for pre-defined sizes.
* Adding grid column size as predefined size, c1-c24 for a 24 column grid. Configure in `img.php`.
* Corrected error on naming cache-files using subdir.
* Corrected calculation error on width & height for crop-to-fit.
* Adding effects for sharpen, emboss and blur through imageconvolution using matrixes.
* crop-to-fit, add parameter for offset x and y to enable to define which area is the, implemented as area.
* Support for resizing opaque images.
* Center of the image from which the crop is done. Improved usage of area to crop.
* Added support for % in width & height.
* Added aspect-ratio.
* Added scale.
* Quality for PNG images is now knows as deflate.
* Added palette to create images with max 256 colors.
* Added usage of all parameters to README.md
* Added documentation here http://dbwebb.se/opensource/cimage
* Adding `.gitignore`
* Re-adding `cache` directory
v0.3 (2012-10-02)
-------------------------------------
* Added crop. Can crop a area (`width`, `height`, `start_x`, `start_y`) from the original
image.
* Corrected to make the 304 Not Modified header work.
* Predefined sizes can be configured for width in `img.php`.
* Corrected to make crop work with width or height in combination with crop-to-fit.
v0.2 (2012-05-09)
-------------------------------------
* Implemented filters as in http://php.net/manual/en/function.imagefilter.php
* Changed `crop` to `crop_to_fit`, works the same way.
* Changed arguments and sends them in array.
* Added quality-setting.
* Added testcases for above.
v0.1.1 (2012-04-27)
-------------------------------------
* Corrected calculation where both width and height were set.
v0.1 (2012-04-25)
-------------------------------------
* Initial release after rewriting some older code doing the same, but not that good and flexible.

@ -13,7 +13,8 @@ return array(
* Default values:
* mode: 'production'
*/
//'mode' => 'production', // 'development', 'strict'
'mode' => 'development',
//'mode' => 'production', // 'development', 'strict'
@ -21,8 +22,8 @@ return array(
* Where are the sources for the classfiles.
*
* Default values:
* autoloader: null
* cimage_class: null
* autoloader: null // used from v0.6.2
* cimage_class: null // used until v0.6.1
*/
'autoloader' => __DIR__ . '/../autoload.php',
//'cimage_class' => __DIR__ . '/../CImage.php',

@ -2,6 +2,9 @@
/**
* Resize and crop images on the fly, store generated images in a cache.
*
* This version is a all-in-one version of img.php, it is not dependant an any other file
* so you can simply copy it to any place you want it.
*
* @author Mikael Roos mos@dbwebb.se
* @example http://dbwebb.se/opensource/cimage
* @link https://github.com/mosbth/cimage
@ -11,19 +14,22 @@
/**
* Change configuration details in the array below or create a separate file
* where you store the configuration details. Name the config file same name as
* this file and add '_config.php'. If this file is named 'img.php' then name the
* config file 'img_config.php'.
* where you store the configuration details.
*
* The configuration file should be named the same name as this file and then
* add '_config.php'. If this file is named 'img.php' then name the
* config file should be named 'img_config.php'.
*
* The settings below are only a few of the available ones. Check the file in
* webroot/img_config.php for a complete list of configuration options.
*/
$config = array(
//'mode' => 'production', // 'production', 'development', 'strict'
//'mode' => 'production', // 'production', 'development', 'strict'
//'image_path' => __DIR__ . '/img/',
//'cache_path' => __DIR__ . '/../cache/',
//'alias_path' => __DIR__ . '/img/alias/',
//'remote_allow' => true,
//'password' => false, // "secret-password",
//'remote_allow' => true,
//'password' => false, // "secret-password",
);

@ -2,6 +2,9 @@
/**
* Resize and crop images on the fly, store generated images in a cache.
*
* This version is a all-in-one version of img.php, it is not dependant an any other file
* so you can simply copy it to any place you want it.
*
* @author Mikael Roos mos@dbwebb.se
* @example http://dbwebb.se/opensource/cimage
* @link https://github.com/mosbth/cimage
@ -11,20 +14,23 @@
/**
* Change configuration details in the array below or create a separate file
* where you store the configuration details. Name the config file same name as
* this file and add '_config.php'. If this file is named 'img.php' then name the
* config file 'img_config.php'.
* where you store the configuration details.
*
* The configuration file should be named the same name as this file and then
* add '_config.php'. If this file is named 'img.php' then name the
* config file should be named 'img_config.php'.
*
* The settings below are only a few of the available ones. Check the file in
* webroot/img_config.php for a complete list of configuration options.
*/
$config = array(
'mode' => 'development', // 'production', 'development', 'strict'
//'mode' => 'production', // 'production', 'development', 'strict'
//'image_path' => __DIR__ . '/img/',
//'cache_path' => __DIR__ . '/../cache/',
//'alias_path' => __DIR__ . '/img/alias/',
//'remote_allow' => true,
//'password' => false, // "secret-password",
//'remote_allow' => true,
//'password' => false, // "secret-password",
);
@ -586,7 +592,7 @@ class CRemoteImage
*/
public function loadCacheDetails()
{
$cacheFile = str_replace(["/", ":", "#", ".", "?"], "-", $this->url);
$cacheFile = str_replace(array("/", ":", "#", ".", "?"), "-", $this->url);
$this->fileName = $this->saveFolder . $cacheFile;
$this->fileJson = $this->fileName . ".json";
if (is_readable($this->fileJson)) {

@ -2,6 +2,9 @@
/**
* Resize and crop images on the fly, store generated images in a cache.
*
* This version is a all-in-one version of img.php, it is not dependant an any other file
* so you can simply copy it to any place you want it.
*
* @author Mikael Roos mos@dbwebb.se
* @example http://dbwebb.se/opensource/cimage
* @link https://github.com/mosbth/cimage
@ -11,20 +14,23 @@
/**
* Change configuration details in the array below or create a separate file
* where you store the configuration details. Name the config file same name as
* this file and add '_config.php'. If this file is named 'img.php' then name the
* config file 'img_config.php'.
* where you store the configuration details.
*
* The configuration file should be named the same name as this file and then
* add '_config.php'. If this file is named 'img.php' then name the
* config file should be named 'img_config.php'.
*
* The settings below are only a few of the available ones. Check the file in
* webroot/img_config.php for a complete list of configuration options.
*/
$config = array(
//'mode' => 'production', // 'production', 'development', 'strict'
//'mode' => 'production', // 'production', 'development', 'strict'
//'image_path' => __DIR__ . '/img/',
//'cache_path' => __DIR__ . '/../cache/',
//'alias_path' => __DIR__ . '/img/alias/',
//'remote_allow' => true,
//'password' => false, // "secret-password",
//'remote_allow' => true,
//'password' => false, // "secret-password",
);
@ -586,7 +592,7 @@ class CRemoteImage
*/
public function loadCacheDetails()
{
$cacheFile = str_replace(["/", ":", "#", ".", "?"], "-", $this->url);
$cacheFile = str_replace(array("/", ":", "#", ".", "?"), "-", $this->url);
$this->fileName = $this->saveFolder . $cacheFile;
$this->fileJson = $this->fileName . ".json";
if (is_readable($this->fileJson)) {

@ -2,6 +2,9 @@
/**
* Resize and crop images on the fly, store generated images in a cache.
*
* This version is a all-in-one version of img.php, it is not dependant an any other file
* so you can simply copy it to any place you want it.
*
* @author Mikael Roos mos@dbwebb.se
* @example http://dbwebb.se/opensource/cimage
* @link https://github.com/mosbth/cimage
@ -11,20 +14,23 @@
/**
* Change configuration details in the array below or create a separate file
* where you store the configuration details. Name the config file same name as
* this file and add '_config.php'. If this file is named 'img.php' then name the
* config file 'img_config.php'.
* where you store the configuration details.
*
* The configuration file should be named the same name as this file and then
* add '_config.php'. If this file is named 'img.php' then name the
* config file should be named 'img_config.php'.
*
* The settings below are only a few of the available ones. Check the file in
* webroot/img_config.php for a complete list of configuration options.
*/
$config = array(
'mode' => 'strict', // 'production', 'development', 'strict'
//'mode' => 'production', // 'production', 'development', 'strict'
//'image_path' => __DIR__ . '/img/',
//'cache_path' => __DIR__ . '/../cache/',
//'alias_path' => __DIR__ . '/img/alias/',
//'remote_allow' => true,
//'password' => false, // "secret-password",
//'remote_allow' => true,
//'password' => false, // "secret-password",
);
@ -586,7 +592,7 @@ class CRemoteImage
*/
public function loadCacheDetails()
{
$cacheFile = str_replace(["/", ":", "#", ".", "?"], "-", $this->url);
$cacheFile = str_replace(array("/", ":", "#", ".", "?"), "-", $this->url);
$this->fileName = $this->saveFolder . $cacheFile;
$this->fileJson = $this->fileName . ".json";
if (is_readable($this->fileJson)) {