diff --git a/.travis.yml b/.travis.yml index 2ba3fc1..cb7f854 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: php sudo: false php: - - 5.4 - 5.5 - 5.6 - 7.0 diff --git a/README.md b/README.md index 907642f..1a64908 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Imagine Plugin for CakePHP3 # -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.txt) -[![Build Status](https://img.shields.io/travis/burzum/cakephp-imagine-plugin/3.0.svg?style=flat-square)](https://travis-ci.org/burzum/cakephp-imagine-plugin) +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.txt) +[![Build Status](https://img.shields.io/travis/burzum/cakephp-imagine-plugin/3.0.svg?style=flat-square)](https://travis-ci.org/burzum/cakephp-imagine-plugin) [![Coverage Status](https://img.shields.io/coveralls/burzum/cakephp-imagine-plugin/3.0.svg?style=flat-square)](https://coveralls.io/r/burzum/cakephp-imagine-plugin) The **Imagine** plugin is a CakePHP wrapper around the [Imagine image manipulation library](https://github.com/avalanche123/Imagine). It makes it very easy to manipulate image data like resize, thumbnail, crop or even to do more complex tasks like creating a photo collage. Also it abstracts the different ways, GD, Imagick, Imagick Shell to work with image data in php. @@ -30,8 +30,6 @@ Contributing To contribute to this plugin please follow a few basic rules. -To contribute to this plugin please follow a few basic rules. - * Pull requests must be send to the ```develop``` branch. * Contributions must follow the [PSR2-**R** coding standard recommendation](https://github.com/php-fig-rectified/fig-rectified-standards). * [Unit tests](http://book.cakephp.org/3.0/en/development/testing.html) are required. diff --git a/composer.json b/composer.json index 0119330..d70ca5c 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "cakephp/plugin-installer": "*" }, "require-dev": { - "phpunit/phpunit": "*" + "phpunit/phpunit": "4.*" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..0b49ade --- /dev/null +++ b/composer.lock @@ -0,0 +1,1383 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "6e22cc825ebf39380860130833d60351", + "content-hash": "6afa4227db44e38c50ad5abf96ba7c75", + "packages": [ + { + "name": "aura/installer-default", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/auraphp/installer-default.git", + "reference": "52f8de3670cc1ef45a916f40f732937436d028c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/auraphp/installer-default/zipball/52f8de3670cc1ef45a916f40f732937436d028c8", + "reference": "52f8de3670cc1ef45a916f40f732937436d028c8", + "shasum": "" + }, + "type": "composer-installer", + "extra": { + "class": "Aura\\Composer\\DefaultInstaller" + }, + "autoload": { + "psr-0": { + "Aura\\Composer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Paul M. Jones", + "email": "pmjones88@gmail.com", + "homepage": "http://paul-m-jones.com" + } + ], + "description": "Installs Aura packages using the Composer defaults.", + "keywords": [ + "aura", + "installer" + ], + "time": "2012-11-26 21:35:57" + }, + { + "name": "aura/intl", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/auraphp/Aura.Intl.git", + "reference": "c5fe620167550ad6fa77dd3570fba2efc77a2a21" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/auraphp/Aura.Intl/zipball/c5fe620167550ad6fa77dd3570fba2efc77a2a21", + "reference": "c5fe620167550ad6fa77dd3570fba2efc77a2a21", + "shasum": "" + }, + "require": { + "aura/installer-default": "1.0.*", + "php": ">=5.4.0" + }, + "type": "aura-package", + "extra": { + "aura": { + "type": "library", + "config": { + "common": "Aura\\Intl\\_Config\\Common" + } + }, + "branch-alias": { + "dev-develop": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Aura\\Intl": "src/" + }, + "psr-4": { + "Aura\\Intl\\_Config\\": "config/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Paul M. Jones", + "email": "pmjones88@gmail.com", + "homepage": "http://paul-m-jones.com" + }, + { + "name": "Aura.Intl Contributors", + "homepage": "https://github.com/auraphp/Aura.Intl/contributors" + }, + { + "name": "Pascal Borreli", + "email": "pascal@borreli.com" + }, + { + "name": "Mapthegod", + "email": "mapthegod@gmail.com" + }, + { + "name": "Jose Lorenzo Rodriguez", + "email": "jose.zap@gmail.com" + } + ], + "description": "The Aura.Intl package provides internationalization (I18N) tools, specifically\npackage-oriented per-locale message translation.", + "homepage": "http://auraphp.com/Aura.Intl", + "keywords": [ + "g11n", + "globalization", + "i18n", + "internationalization", + "intl", + "l10n", + "localization" + ], + "time": "2014-08-24 00:00:00" + }, + { + "name": "cakephp/cakephp", + "version": "3.1.7", + "source": { + "type": "git", + "url": "https://github.com/cakephp/cakephp.git", + "reference": "a91f654a19802cb4f6cd60ff91bb062b782bc99c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/cakephp/zipball/a91f654a19802cb4f6cd60ff91bb062b782bc99c", + "reference": "a91f654a19802cb4f6cd60ff91bb062b782bc99c", + "shasum": "" + }, + "require": { + "aura/intl": "1.1.*", + "ext-intl": "*", + "ext-mbstring": "*", + "ircmaxell/password-compat": "1.0.*", + "nesbot/carbon": "1.13.*", + "php": ">=5.4.16", + "psr/log": "1.0" + }, + "replace": { + "cakephp/cache": "self.version", + "cakephp/collection": "self.version", + "cakephp/core": "self.version", + "cakephp/database": "self.version", + "cakephp/datasource": "self.version", + "cakephp/event": "self.version", + "cakephp/filesystem": "self.version", + "cakephp/i18n": "self.version", + "cakephp/log": "self.version", + "cakephp/orm": "self.version", + "cakephp/utility": "self.version", + "cakephp/validation": "self.version" + }, + "require-dev": { + "cakephp/cakephp-codesniffer": "dev-master", + "phpunit/phpunit": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cake\\": "src" + }, + "files": [ + "src/Core/functions.php", + "src/Collection/functions.php", + "src/I18n/functions.php", + "src/Utility/bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/cakephp/graphs/contributors" + } + ], + "description": "The CakePHP framework", + "homepage": "http://cakephp.org", + "keywords": [ + "framework" + ], + "time": "2016-01-09 23:14:54" + }, + { + "name": "cakephp/plugin-installer", + "version": "0.0.12", + "source": { + "type": "git", + "url": "https://github.com/cakephp/plugin-installer.git", + "reference": "8a71f10fcc455b8b9756529433d5f0fd818b0ce1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/plugin-installer/zipball/8a71f10fcc455b8b9756529433d5f0fd818b0ce1", + "reference": "8a71f10fcc455b8b9756529433d5f0fd818b0ce1", + "shasum": "" + }, + "require-dev": { + "cakephp/cakephp-codesniffer": "dev-master", + "composer/composer": "1.0.*@dev" + }, + "type": "composer-installer", + "extra": { + "class": "Cake\\Composer\\Installer\\PluginInstaller" + }, + "autoload": { + "psr-4": { + "Cake\\Composer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "http://cakephp.org" + } + ], + "description": "A composer installer for CakePHP 3.0+ plugins.", + "time": "2015-06-10 10:35:13" + }, + { + "name": "imagine/imagine", + "version": "v0.6.3", + "source": { + "type": "git", + "url": "https://github.com/avalanche123/Imagine.git", + "reference": "149041d2a1b517107bfe270ca2b1a17aa341715d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/avalanche123/Imagine/zipball/149041d2a1b517107bfe270ca2b1a17aa341715d", + "reference": "149041d2a1b517107bfe270ca2b1a17aa341715d", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "sami/sami": "dev-master" + }, + "suggest": { + "ext-gd": "to use the GD implementation", + "ext-gmagick": "to use the Gmagick implementation", + "ext-imagick": "to use the Imagick implementation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.7-dev" + } + }, + "autoload": { + "psr-0": { + "Imagine": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bulat Shakirzyanov", + "email": "mallluhuct@gmail.com", + "homepage": "http://avalanche123.com" + } + ], + "description": "Image processing for PHP 5.3", + "homepage": "http://imagine.readthedocs.org/", + "keywords": [ + "drawing", + "graphics", + "image manipulation", + "image processing" + ], + "time": "2015-09-19 16:54:05" + }, + { + "name": "ircmaxell/password-compat", + "version": "v1.0.4", + "source": { + "type": "git", + "url": "https://github.com/ircmaxell/password_compat.git", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "autoload": { + "files": [ + "lib/password.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthony Ferrara", + "email": "ircmaxell@php.net", + "homepage": "http://blog.ircmaxell.com" + } + ], + "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", + "homepage": "https://github.com/ircmaxell/password_compat", + "keywords": [ + "hashing", + "password" + ], + "time": "2014-11-20 16:49:30" + }, + { + "name": "nesbot/carbon", + "version": "1.13.0", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "5cb6e71055f7b0b57956b73d324cc4de31278f42" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/5cb6e71055f7b0b57956b73d324cc4de31278f42", + "reference": "5cb6e71055f7b0b57956b73d324cc4de31278f42", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Carbon": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + } + ], + "description": "A simple API extension for DateTime.", + "homepage": "https://github.com/briannesbitt/Carbon", + "keywords": [ + "date", + "datetime", + "time" + ], + "time": "2014-09-26 02:52:02" + }, + { + "name": "psr/log", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Psr\\Log\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2012-12-21 11:40:51" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2015-02-03 12:10:50" + }, + { + "name": "phpspec/prophecy", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "phpdocumentor/reflection-docblock": "~2.0", + "sebastian/comparator": "~1.1" + }, + "require-dev": { + "phpspec/phpspec": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2015-08-13 10:07:40" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-10-06 15:47:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2015-06-21 13:08:43" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2015-06-21 08:01:12" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-09-15 10:49:45" + }, + { + "name": "phpunit/phpunit", + "version": "4.8.21", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "ea76b17bced0500a28098626b84eda12dbcf119c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea76b17bced0500a28098626b84eda12dbcf119c", + "reference": "ea76b17bced0500a28098626b84eda12dbcf119c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": ">=1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2015-12-12 07:45:58" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-10-02 06:51:40" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, + { + "name": "sebastian/environment", + "version": "1.3.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "6e7133793a8e5a5714a551a8324337374be209df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df", + "reference": "6e7133793a8e5a5714a551a8324337374be209df", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2015-12-02 08:37:27" + }, + { + "name": "sebastian/exporter", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2015-06-21 07:55:53" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12 03:26:01" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-11-11 19:50:13" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" + }, + { + "name": "symfony/yaml", + "version": "v3.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691", + "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2015-12-26 13:39:53" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/src/Lib/ImageProcessor.php b/src/Lib/ImageProcessor.php index d1118f5..5a7a992 100644 --- a/src/Lib/ImageProcessor.php +++ b/src/Lib/ImageProcessor.php @@ -2,51 +2,51 @@ namespace Burzum\Imagine\Lib; use Cake\Core\InstanceConfigTrait; -use \Imagine\Image\ImageInterface; -use \Imagine\Image\Point; -use \Imagine\Image\Box; +use Imagine\Image\ImageInterface; +use Imagine\Image\Point; +use Imagine\Image\Box; class ImageProcessor { use InstanceConfigTrait; -/** - * Default settings - * - * @var array - */ + /** + * Default settings + * + * @var array + */ protected $_defaultConfig = [ 'engine' => 'Gd' ]; -/** - * Imagine Engine Instance - * - * @var Object - */ + /** + * Imagine Engine Instance + * + * @var \Imagine\Image\AbstractImagine; + */ protected $_imagine = null; -/** - * Image object instace - * - * @var Object - */ + /** + * Image object instace + * + * @var \Imagine\Image\AbstractImage + */ protected $_image = null; -/** - * Constructor - * - * @var array - */ + /** + * Constructor + * + * @var array + */ public function __construct(array $config = []) { $this->config($config); } -/** - * Get the imagine object - * - * @return Imagine object - */ + /** + * Get the imagine object + * + * @return Imagine object + */ public function imagine($renew = false) { if (empty($this->_imagine) || $renew === true) { $class = '\Imagine\\' . $this->config('engine') . '\Imagine'; @@ -56,41 +56,43 @@ public function imagine($renew = false) { return $this->_imagine; } -/** - * Opens an image file for processing. - * - * @param string $image Image file. - * @return Object Imagine Image class object, depending on the chosen engine. - */ + /** + * Opens an image file for processing. + * + * @param string $image Image file. + * @return Object Imagine Image class object, depending on the chosen engine. + */ public function open($image) { if (!file_exists($image)) { - throw new \RuntimeException(sprintf('File %s does not exist!', $image)); + throw new \RuntimeException(sprintf('File `%s` does not exist!', $image)); } $this->_image = $this->imagine()->open($image); return $this; } -/** - * - */ + /** + * Gets the image object. + * + * @return \Imagine\Image\AbstractImage; + */ public function image() { return $this->_image; } -/** - * Loads an image and applies operations on it - * - * Caching and taking care of the file storage is NOT the purpose of this method! - * - * @param null $output - * @param array $imagineOptions - * @param array $operations - * @throws \BadMethodCallException - * @internal param string $image source image path - * @internal param $mixed - * @internal param \Imagine $array image objects save() 2nd parameter options - * @return bool - */ + /** + * Loads an image and applies operations on it + * + * Caching and taking care of the file storage is NOT the purpose of this method! + * + * @param null $output + * @param array $imagineOptions + * @param array $operations + * @throws \BadMethodCallException + * @internal param string $image source image path + * @internal param $mixed + * @internal param \Imagine $array image objects save() 2nd parameter options + * @return bool + */ public function batchProcess($output = null, $operations = [], $imagineOptions = []) { foreach ($operations as $operation => $params) { if (method_exists($this, $operation)) { @@ -108,66 +110,67 @@ public function batchProcess($output = null, $operations = [], $imagineOptions = return $this->save($output, $imagineOptions); } -/** - * Saves an image. - * - * @param string $output Output filename. - * @param array $options Imagine image saving options. - * @return bool - */ + /** + * Saves an image. + * + * @param string $output Output filename. + * @param array $options Imagine image saving options. + * @return bool + */ public function save($output, array $options = []) { $this->_image->save($output, $options); $this->_image = null; return true; } -/** - * Compatibility method for legacy reasons. - * - * @deprecated Use batchProcess() instead. - */ + /** + * Compatibility method for legacy reasons. + * + * @deprecated Use batchProcess() instead. + */ public function processImage($output = null, $imagineOptions = [], $operations = []) { + user_error('processImage() is deprecated, use batchProcess() instead!', E_NOTICE); return $this->batchProcess($output, $operations, $imagineOptions); } -/** - * Turns the operations and their params into a string that can be used in a file name to cache an image. - * - * Suffix your image with the string generated by this method to be able to batch delete a file that has versions of it cached. - * The intended usage of this is to store the files as my_horse.thumbnail+width-100-height+100.jpg for example. - * - * So after upload store your image meta data in a db, give the filename the id of the record and suffix it - * with this string and store the string also in the db. In the views, if no further control over the image access is needd, - * you can simply direct linke the image like $this->Html->image('/images/05/04/61/my_horse.thumbnail+width-100-height+100.jpg'); - * - * @param array $operations Imagine image operations - * @param array $separators Optional - * @param bool $hash - * @return string Filename compatible String representation of the operations - * @link http://support.microsoft.com/kb/177506 - */ + /** + * Turns the operations and their params into a string that can be used in a file name to cache an image. + * + * Suffix your image with the string generated by this method to be able to batch delete a file that has versions of it cached. + * The intended usage of this is to store the files as my_horse.thumbnail+width-100-height+100.jpg for example. + * + * So after upload store your image meta data in a db, give the filename the id of the record and suffix it + * with this string and store the string also in the db. In the views, if no further control over the image access is needd, + * you can simply direct linke the image like $this->Html->image('/images/05/04/61/my_horse.thumbnail+width-100-height+100.jpg'); + * + * @param array $operations Imagine image operations + * @param array $separators Optional + * @param bool $hash + * @return string Filename compatible String representation of the operations + * @link http://support.microsoft.com/kb/177506 + */ public function operationsToString($operations, $separators = [], $hash = false) { return ImagineUtility::operationsToString($operations, $separators, $hash); } -/** - * hashImageOperations - * - * @param array $imageSizes - * @param int $hashLength - * @return string - */ + /** + * hashImageOperations + * + * @param array $imageSizes + * @param int $hashLength + * @return string + */ public function hashImageOperations($imageSizes, $hashLength = 8) { return ImagineUtility::hashImageOperations($imageSizes, $hashLength = 8); } -/** - * Wrapper for Imagines crop - * - * @param array Array of options for processing the image - * @throws \InvalidArgumentException - * @return $this - */ + /** + * Wrapper for Imagines crop + * + * @param array Array of options for processing the image + * @throws \InvalidArgumentException + * @return $this + */ public function crop(array $options = []) { if (empty($options['height']) || empty($options['width'])) { throw new \InvalidArgumentException('You have to pass height and width in the options!'); @@ -187,13 +190,13 @@ public function crop(array $options = []) { return $this; } -/** - * Crops an image based on its widht or height, crops it to a square and resizes it to the given size - * - * @param array Array of options for processing the image. - * @throws \InvalidArgumentException - * @return $this - */ + /** + * Crops an image based on its widht or height, crops it to a square and resizes it to the given size + * + * @param array Array of options for processing the image. + * @throws \InvalidArgumentException + * @return $this + */ public function squareCenterCrop(array $options = []) { if (empty($options['size'])) { throw new \InvalidArgumentException(__d('imagine', 'You have to pass size in the options!')); @@ -221,13 +224,13 @@ public function squareCenterCrop(array $options = []) { return $this; } -/** - * Widen - * - * @param array Array of options for processing the image. - * @throws \InvalidArgumentException - * @return void - */ + /** + * Widen + * + * @param array Array of options for processing the image. + * @throws \InvalidArgumentException + * @return void + */ public function widen(array $options = []) { if (empty($options['size'])) { throw new \InvalidArgumentException(__d('imagine', 'You must pass a size value!')); @@ -236,13 +239,13 @@ public function widen(array $options = []) { return $this; } -/** - * Heighten - * - * @param array Array of options for processing the image. - * @throws \InvalidArgumentException - * @return $this - */ + /** + * Heighten + * + * @param array Array of options for processing the image. + * @throws \InvalidArgumentException + * @return $this + */ public function heighten(array $options = []) { if (empty($options['size'])) { throw new \InvalidArgumentException(__d('imagine', 'You must pass a size value!')); @@ -250,13 +253,13 @@ public function heighten(array $options = []) { $this->widenAndHeighten(['height' => $options['size']]); } -/** - * WidenAndHeighten - * - * @param array Array of options for processing the image. - * @throws \InvalidArgumentException - * @return $this - */ + /** + * WidenAndHeighten + * + * @param array Array of options for processing the image. + * @throws \InvalidArgumentException + * @return $this + */ public function widenAndHeighten(array $options = []) { if (empty($options['height']) && empty($options['width']) && empty($options['size'])) { throw new \InvalidArgumentException(__d('imagine', 'You have to pass a height, width or size!')); @@ -311,14 +314,13 @@ public function widenAndHeighten(array $options = []) { return $this; } -/** - * Heighten - * - * @param $Image - * @param array $options - * @throws \InvalidArgumentException - * @return void - */ + /** + * Heighten + * + * @param array $options + * @throws \InvalidArgumentException + * @return void + */ public function scale(array $options = []) { if (empty($options['factor'])) { throw new \InvalidArgumentException(__d('imagine', 'You must pass a factor value!')); @@ -334,13 +336,13 @@ public function scale(array $options = []) { return $this; } -/** - * Wrapper for Imagine flipHorizontally and flipVertically - * - * @param array Array of options for processing the image. - * @throws \InvalidArgumentException - * @return $this - */ + /** + * Wrapper for Imagine flipHorizontally and flipVertically + * + * @param array Array of options for processing the image. + * @throws \InvalidArgumentException + * @return $this + */ public function flip(array $options = []) { if (!isset($options['direction'])) { $options['direction'] = 'vertically'; @@ -353,62 +355,78 @@ public function flip(array $options = []) { return $this; } -/** - * Wrapper for rotate - * - * @param array Array of options for processing the image. - * @return $this - */ + /** + * Wrapper for rotate + * + * @param array Array of options for processing the image. + * @return $this + */ public function rotate(array $options = []) { $this->_image->rotate($options['degree']); return $this; } -/** - * Wrapper for Imagines thumbnail. - * - * @throws \InvalidArgumentException - * @param array Array of options for processing the image. - * @throws InvalidArgumentException if no height or width was passed - * @return $this - */ + /** + * Wrapper for Imagines thumbnail. + * + * @throws \InvalidArgumentException + * @param array Array of options for processing the image. + * @throws InvalidArgumentException if no height or width was passed + * @return $this + */ public function thumbnail(array $options = []) { + $this->_thumbnail($this->_image, $options); + return $this; + } + + /** + * Workaround method... + * + * Seriously, I have NO IDEA why this only works when passed through a + * method as reference... If you use the very same code in the thumbnail() + * method directly it doesn't resize. I think there is weird bug with the + * references or something in Imagine itself going on. Their own example is + * not working properly. See https://github.com/avalanche123/Imagine/issues/478 + * + * @link https://github.com/avalanche123/Imagine/issues/478 + * @param \Imagine\Image\AbstractImage + * @throws InvalidArgumentException if no height or width was passed + * @return void + */ + protected function _thumbnail(&$Image, $options) { if (empty($options['height']) || empty($options['width'])) { - throw new \InvalidArgumentException('You have to pass height and width in the options!'); + throw new \InvalidArgumentException(__d('imagine', 'You have to pass height and width in the options!')); } - $mode = ImageInterface::THUMBNAIL_INSET; if (isset($options['mode']) && $options['mode'] === 'outbound') { $mode = ImageInterface::THUMBNAIL_OUTBOUND; } - - $this->_image = $this->_image->thumbnail(new Box($options['width'], $options['height']), $mode); - return $this; + $Image = $Image->thumbnail(new Box($options['width'], $options['height']), $mode); } -/** - * Wrapper for Imagines resize - * - * @param array Array of options for processing the image - * @throws \InvalidArgumentException - * @return $this - */ - public function resize($Image, array $options = []) { + /** + * Wrapper for Imagines resize + * + * @param array Array of options for processing the image + * @throws \InvalidArgumentException + * @return $this + */ + public function resize(array $options = []) { if (empty($options['height']) || empty($options['width'])) { throw new \InvalidArgumentException(__d('imagine', 'You have to pass height and width in the options!')); } - $this->_image = $Image->resize(new Box($options['width'], $options['height'])); + $this->_image = $this->_image->resize(new Box($options['width'], $options['height'])); return $this; } -/** - * Gets the size of an image - * - * @param mixed Imagine Image object or string of a file name - * @return array first value is width, second height - * @see Imagine\Image\ImageInterface::getSize() - */ + /** + * Gets the size of an image + * + * @param mixed Imagine Image object or string of a file name + * @return array first value is width, second height + * @see Imagine\Image\ImageInterface::getSize() + */ public function getImageSize($Image = null) { $Image = $this->_getImage($Image); $BoxInterface = $Image->getSize($Image); @@ -420,13 +438,13 @@ public function getImageSize($Image = null) { ]; } -/** - * Gets an image from a file string or returns the image object that is - * loaded in the ImageProcessor::_image property. - * - * @param string|null $Image - * @return \Imagine\Image\ - */ + /** + * Gets an image from a file string or returns the image object that is + * loaded in the ImageProcessor::_image property. + * + * @param string|null $Image + * @return \Imagine\Image\ + */ protected function _getImage($Image = null) { if (is_string($Image)) { $class = 'Imagine\\' . $this->config('engine') . '\Imagine'; diff --git a/src/Model/Behavior/ImagineBehavior.php b/src/Model/Behavior/ImagineBehavior.php index e0d252e..e2b7eb9 100644 --- a/src/Model/Behavior/ImagineBehavior.php +++ b/src/Model/Behavior/ImagineBehavior.php @@ -10,9 +10,10 @@ */ namespace Burzum\Imagine\Model\Behavior; +use Burzum\Imagine\Lib\ImagineUtility; use Cake\ORM\Behavior; use Cake\ORM\Table; -use Burzum\Imagine\Lib\ImagineUtility; +use Imagine\Image\AbstractImage; /** * CakePHP Imagine Plugin @@ -25,367 +26,166 @@ class ImagineBehavior extends Behavior { * @var array */ protected $_defaultConfig = [ - 'engine' => 'Gd' + 'engine' => 'Gd', + 'processorClass' => '\Burzum\Imagine\Lib\ImageProcessor' ]; -/** - * Keeping a reference to the table in order to, - * be able to retrieve associations and fetch records for counting. - * - * @var array - */ - protected $_table; - -/** - * Constructor - * - * @param Table $table The table this behavior is attached to. - * @param array $settings The settings for this behavior. - */ + /** + * Class name of the image processor to use. + * + * @var string + */ + protected $_processorClass; + + /** + * Constructor + * + * @param Table $table The table this behavior is attached to. + * @param array $settings The settings for this behavior. + */ public function __construct(Table $table, array $settings = []) { parent::__construct($table, $settings); $class = '\Imagine\\' . $this->config('engine') . '\Imagine'; $this->Imagine = new $class(); $this->_table = $table; + $processorClass = $this->config('processorClass'); + $this->_processor = new $processorClass($this->config()); } -/** - * Get the imagine object - * - * @return Imagine object - */ - public function imagineObject() { - return $this->Imagine; - } - -/** - * Loads an image and applies operations on it - * - * Caching and taking care of the file storage is NOT the purpose of this method! - * - * @param $ImageObject - * @param null $output - * @param array $imagineOptions - * @param array $operations - * @throws \BadMethodCallException - * @internal param string $image source image path - * @internal param $mixed - * @internal param \Imagine $array image objects save() 2nd parameter options - * @return bool - */ - public function processImage($ImageObject, $output = null, $imagineOptions = [], $operations = []) { - if (is_string($ImageObject)) { - $ImageObject = $this->Imagine->open($ImageObject); - } - - foreach ($operations as $operation => $params) { - if (method_exists($this->_table, $operation)) { - $this->_table->{$operation}($ImageObject, $params); - } elseif (method_exists($this, $operation)) { - $this->{$operation}($ImageObject, $params); - } else { - throw new \BadMethodCallException(__d('imagine', 'Unsupported image operation {0}!', $operation)); - } - } - - if ($output === null) { - return $ImageObject; - } - - return $ImageObject->save($output, $imagineOptions); - } - -/** - * Turns the operations and their params into a string that can be used in a file name to cache an image. - * - * Suffix your image with the string generated by this method to be able to batch delete a file that has versions of it cached. - * The intended usage of this is to store the files as my_horse.thumbnail+width-100-height+100.jpg for example. - * - * So after upload store your image meta data in a db, give the filename the id of the record and suffix it - * with this string and store the string also in the db. In the views, if no further control over the image access is needed, - * you can simply direct-link the image like $this->Html->image('/images/05/04/61/my_horse.thumbnail+width-100-height+100.jpg'); - * - * @param array $operations Imagine image operations - * @param array $separators Optional - * @param bool $hash - * @return string Filename compatible String representation of the operations - * @link http://support.microsoft.com/kb/177506 - */ - public function operationsToString($operations, $separators = [], $hash = false) { - return ImagineUtility::operationsToString($operations, $separators, $hash); + /** + * Returns the image processor object. + * + * @return mixed + */ + public function getImageProcessor() { + return $this->_processor; } -/** - * hashImageOperations - * - * @param array $imageSizes - * @param int $hashLength - * @return string - */ - public function hashImageOperations($imageSizes, $hashLength = 8) { - return ImagineUtility::hashImageOperations($imageSizes, $hashLength = 8); + /** + * Get the imagine object + * + * @deprecated Call ImagineBehavior->getImageProcessor()->imagine() instead. + * @return Imagine object + */ + public function imagineObject() { + return $this->_processor->imagine(); } -/** - * Wrapper for Imagines crop - * - * @param $Image - * @param array Array of options for processing the image - * @throws \InvalidArgumentException - * @return void - */ - public function crop($Image, $options = []) { - if (empty($options['height']) || empty($options['width'])) { - throw new \InvalidArgumentException(__d('imagine', 'You have to pass height and width in the options!')); + /** + * Delegate the calls to the image processor lib. + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, $args) { + if (method_exists($this->_processor, $args)) { + return call_user_func_array([$this->_processor, $method], $args); } - - $defaults = [ - 'cropX' => 0, - 'cropY' => 0 - ]; - - $options = array_merge($defaults, $options); - - $Image->crop(new \Imagine\Image\Point($options['cropX'], $options['cropY']), new \Imagine\Image\Box($options['width'], $options['height'])); } -/** - * Crops an image based on its widht or height, crops it to a square and resizes it to the given size - * - * @param $Image - * @param array Array of options for processing the image - * @throws \InvalidArgumentException - * @return void - */ - public function squareCenterCrop($Image, $options = []) { - if (empty($options['size'])) { - throw new \InvalidArgumentException(__d('imagine', 'You have to pass size in the options!')); + /** + * Loads an image and applies operations on it. + * + * Caching and taking care of the file storage is NOT the purpose of this method! + * + * @param string|\Imagine\Image\AbstractImage $ImageObject + * @param string $output + * @param array $imagineOptions + * @param array $operations + * @throws \InvalidArgumentException + * @return bool + */ + public function processImage($image, $output = null, $imagineOptions = [], $operations = []) { + if (is_string($image)) { + $this->_processor->open($image); + $image = $this->_processor->image(); } - - $imageSize = $this->getImageSize($Image); - - $width = $imageSize[0]; - $height = $imageSize[1]; - - if ($width > $height) { - $x2 = $height; - $y2 = $height; - $x = ($width - $height) / 2; - $y = 0; - } else { - $x2 = $width; - $y2 = $width; - $x = 0; - $y = ($height - $width) / 2; - } - - $Image->crop(new \Imagine\Image\Point($x, $y), new \Imagine\Image\Box($x2, $y2)); - $Image->resize(new \Imagine\Image\Box($options['size'], $options['size'])); - } - -/** - * Widen - * - * @param $Image - * @param array $options - * @throws \InvalidArgumentException - * @return void - */ - public function widen($Image, $options = []) { - if (empty($options['size'])) { - throw new \InvalidArgumentException(__d('imagine', 'You must pass a size value!')); + if (!$image instanceof AbstractImage) { + throw new \InvalidArgumentException('An instance of `\Imagine\Image\AbstractImage` is required, you passed `%s`!', get_class($image)); } - $this->widenAndHeighten($Image, ['width' => $options['size']]); - } -/** - * Heighten - * - * @param $Image - * @param array $options - * @throws \InvalidArgumentException - * @return void - */ - public function heighten($Image, $options = []) { - if (empty($options['size'])) { - throw new \InvalidArgumentException(__d('imagine', 'You must pass a size value!')); + $event = $this->_table->dispatchEvent('ImagineBehavior.beforeApplyOperations', compact('image', 'operations')); + if ($event->isStopped()) { + return $event->result; } - $this->widenAndHeighten($Image, ['height' => $options['size']]); - } -/** - * WidenAndHeighten - * - * @param $Image - * @param array $options - * @throws \InvalidArgumentException - * @return void - */ - public function widenAndHeighten($Image, $options = []) { - if (empty($options['height']) && empty($options['width']) && empty($options['size'])) { - throw new \InvalidArgumentException(__d('imagine', 'You have to pass a height, width or size!')); - } + $data = $event->data(); + $this->_applyOperations( + $data['operations'], + $data['image'] + ); - if (!empty($options['height']) && !empty($options['width'])) { - throw new \InvalidArgumentException(__d('imagine', 'You can only scale by width or height!')); + $event = $this->_table->dispatchEvent('ImagineBehavior.afterApplyOperations', $data); + if ($event->isStopped()) { + return $event->result; } - if (isset($options['width'])) { - $size = $options['width']; - $method = 'widen'; - } elseif (isset($options['height'])) { - $size = $options['height']; - $method = 'heighten'; - } else { - $size = $options['size']; - $method = 'scale'; + if ($output === null) { + return $image; } - $imageSize = $this->getImageSize($Image); - $width = $imageSize[0]; - $height = $imageSize[1]; + return $this->_processor->save($output, $imagineOptions); + } - if (isset($options['noUpScale'])) { - if ($method === 'widen') { - if ($size > $width) { - throw new \InvalidArgumentException(__d('imagine', 'You can not scale up!')); - } - } elseif ('heighten') { - if ($size > $height) { - throw new \InvalidArgumentException(__d('imagine', 'You can not scale up!')); - } + /** + * Applies the actual image operations to the image. + * + * @param array $operations + * @param array $image + * @throws \BadMethodCallException + * @return void + */ + protected function _applyOperations($operations, $image) { + foreach ($operations as $operation => $params) { + $event = $this->_table->dispatchEvent('ImagineBehavior.applyOperation', compact('image', 'operations')); + if ($event->isStopped()) { + continue; } - } - - if (isset($options['noDownScale'])) { - if ($method === 'widen') { - if ($size < $width) { - throw new \InvalidArgumentException(__d('imagine', 'You can not scale down!')); - } - } elseif ('heighten') { - if ($size < $height) { - throw new \InvalidArgumentException(__d('imagine', 'You can not scale down!')); - } + if (method_exists($this->_table, $operation)) { + $this->_table->{$operation}($image, $params); + } elseif (method_exists($this->_processor, $operation)) { + $this->_processor->{$operation}($params); + } else { + throw new \BadMethodCallException(__d('imagine', 'Unsupported image operation `{0}`!', $operation)); } } - - $Box = new \Imagine\Image\Box($width, $height); - $Box = $Box->{$method}($size); - $Image->resize($Box); - } - -/** - * Heighten - * - * @param $Image - * @param array $options - * @throws \InvalidArgumentException - * @return void - */ - public function scale($Image, $options = []) { - if (empty($options['factor'])) { - throw new \InvalidArgumentException(__d('imagine', 'You must pass a factor value!')); - } - - $imageSize = $this->getImageSize($Image); - $width = $imageSize[0]; - $height = $imageSize[1]; - - $Box = new \Imagine\Image\Box($width, $height); - $Box = $Box->scale($options['factor']); - $Image->resize($Box); - } - -/** - * Wrapper for Imagine flipHorizontally and flipVertically - * - * @param $Image - * @param array Array of options for processing the image - * @throws \InvalidArgumentException - * @return void - */ - public function flip($Image, $options = []) { - if (!isset($options['direction'])) { - $options['direction'] = 'vertically'; - } - if (!in_array($options['direction'], ['vertically', 'horizontally'])) { - throw new \InvalidArgumentException(__d('imagine', 'Invalid direction, use vertically or horizontally')); - } - $method = 'flip' . $options['direction']; - $Image->{$method}(); - } - -/** - * Wrapper for rotate - * - * @param object Imagine Image Object - * @param array Array of options for processing the image - */ - public function rotate($Image, $options = []) { - $Image->rotate($options['degree']); } -/** - * Wrapper for Imagines thumbnail - * - * @throws \InvalidArgumentException - * @param Imagine Image Object - * @param array Array of options for processing the image - * @throws InvalidArgumentException if no height or width was passed - * @return void - */ - public function thumbnail(&$Image, $options = []) { - if (empty($options['height']) || empty($options['width'])) { - throw new \InvalidArgumentException(__d('imagine', 'You have to pass height and width in the options!')); - } - - $mode = \Imagine\Image\ImageInterface::THUMBNAIL_INSET; - if (isset($options['mode']) && $options['mode'] === 'outbound') { - $mode = \Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND; - } - - $Image = $Image->thumbnail(new \Imagine\Image\Box($options['width'], $options['height']), $mode); + /** + * Turns the operations and their params into a string that can be used in a file name to cache an image. + * + * Suffix your image with the string generated by this method to be able to batch delete a file that has versions of it cached. + * The intended usage of this is to store the files as my_horse.thumbnail+width-100-height+100.jpg for example. + * + * So after upload store your image meta data in a db, give the filename the id of the record and suffix it + * with this string and store the string also in the db. In the views, if no further control over the image access is needed, + * you can simply direct-link the image like $this->Html->image('/images/05/04/61/my_horse.thumbnail+width-100-height+100.jpg'); + * + * @param array $operations Imagine image operations + * @param array $separators Optional + * @param bool $hash + * @return string Filename compatible String representation of the operations + * @link http://support.microsoft.com/kb/177506 + */ + public function operationsToString($operations, $separators = [], $hash = false) { + return ImagineUtility::operationsToString($operations, $separators, $hash); } -/** - * Wrapper for Imagines resize - * - * @param $Image - * @param array Array of options for processing the image - * @throws \InvalidArgumentException - * @internal param \Imagine\Imagine $Imagine Image Object - */ - public function resize($Image, $options = []) { - if (empty($options['height']) || empty($options['width'])) { - throw new \InvalidArgumentException(__d('imagine', 'You have to pass height and width in the options!')); - } - - $Image->resize(new \Imagine\Image\Box($options['width'], $options['height'])); + /** + * hashImageOperations + * + * @param array $imageSizes + * @param int $hashLength + * @return string + */ + public function hashImageOperations($imageSizes, $hashLength = 8) { + return ImagineUtility::hashImageOperations($imageSizes, $hashLength = 8); } -/** - * Gets the size of an image - * - * @param mixed Imagine Image object or string of a file name - * @return array first value is width, second height - * @see Imagine\Image\ImageInterface::getSize() - */ public function getImageSize($Image) { - if (is_string($Image)) { - $class = 'Imagine\\' . $this->config('engine') . '\Imagine'; - $Imagine = new $class(); - $Image = $Imagine->open($Image); - } - - $BoxInterface = $Image->getSize($Image); - - return [ - $BoxInterface->getWidth(), - $BoxInterface->getHeight(), - 'x' => $BoxInterface->getWidth(), - 'y' => $BoxInterface->getHeight() - ]; + return $this->_processor->getImageSize($Image); } } diff --git a/src/Model/Imagine.php b/src/Model/Imagine.php deleted file mode 100644 index 9e1da05..0000000 --- a/src/Model/Imagine.php +++ /dev/null @@ -1,45 +0,0 @@ - ['type' => 'integer'], - 'title' => ['type' => 'string', 'null' => false], - '_constraints' => [ - 'primary' => ['type' => 'primary', 'columns' => ['id']] - ] - ]; - } -} diff --git a/tests/TestCase/Model/Behavior/ImagineBehaviorTest.php b/tests/TestCase/Model/Behavior/ImagineBehaviorTest.php index 90a28c2..17f8c20 100644 --- a/tests/TestCase/Model/Behavior/ImagineBehaviorTest.php +++ b/tests/TestCase/Model/Behavior/ImagineBehaviorTest.php @@ -1,11 +1,10 @@ Model = TableRegistry::get('ImagineTestModel'); $this->Model->addBehavior('Burzum/Imagine.Imagine'); } -/** - * tearDown - * - * @return void - */ + /** + * tearDown + * + * @return void + */ public function tearDown() { unset($this->Model); TableRegistry::clear(); } -/** - * testImagineObject - * - * @return void - */ + /** + * testImagineObject + * + * @return void + */ public function testImagineObject() { $result = $this->Model->imagineObject(); $this->assertTrue(is_a($result, 'Imagine\Gd\Imagine')); } -/** - * testParamsAsFileString - * - * @return void - */ + /** + * testParamsAsFileString + * + * @return void + */ public function testOperationsToString() { $operations = [ 'thumbnail' => [ @@ -84,23 +83,23 @@ public function testOperationsToString() { $this->assertEquals($result, '.thumbnail+width-200+height-150'); } -/** - * getImageSize - * - * @return void - */ + /** + * getImageSize + * + * @return void + */ public function getImageSize() { $image = Plugin::path('Burzum/Imagine') . 'tests' . DS . 'Fixture' . DS . 'cake.icon.png'; $result = $this->Model->getImageSize($image); $this->assertEquals($result, [20, 20]); } -/** - * testCropInvalidArgumentException - * - * @expectedException \InvalidArgumentException - * @return void - */ + /** + * testCropInvalidArgumentException + * + * @expectedException \InvalidArgumentException + * @return void + */ public function testCropInvalidArgumentException() { $image = Plugin::path('Burzum/Imagine') . 'tests' . DS . 'Fixture' . DS . 'titus.jpg'; $this->Model->processImage($image, TMP . 'crop.jpg', [], [ @@ -108,11 +107,28 @@ public function testCropInvalidArgumentException() { ]); } -/** - * testCrop - * - * @return void - */ + /** + * testCrop + * + * @return void + */ + public function testResize() { + $image = Plugin::path('Burzum/Imagine') . 'tests' . DS . 'Fixture' . DS . 'titus.jpg'; + $this->Model->processImage($image, TMP . 'resize.jpg', [], [ + 'resize' => [ + 'height' => 150, + 'width' => 200 + ] + ]); + $result = $this->Model->getImageSize(TMP . 'resize.jpg'); + $this->assertEquals($result, [200, 150, 'x' => 200, 'y' => 150]); + } + + /** + * testCrop + * + * @return void + */ public function testCrop() { $image = Plugin::path('Burzum/Imagine') . 'tests' . DS . 'Fixture' . DS . 'titus.jpg'; $this->Model->processImage($image, TMP . 'crop.jpg', [], [ @@ -121,15 +137,18 @@ public function testCrop() { 'width' => 300 ] ]); + $result = $this->Model->getImageSize(TMP . 'crop.jpg'); + $this->assertEquals($result, [300, 300, 'x' => 300, 'y' => 300]); } -/** - * testThumbnail - * - * @return void - */ + /** + * testThumbnail + * + * @return void + */ public function testThumbnail() { $image = Plugin::path('Burzum/Imagine') . 'tests' . DS . 'Fixture' . DS . 'titus.jpg'; + $this->Model->processImage($image, TMP . 'thumbnail.jpg', [], [ 'thumbnail' => [ 'mode' => 'outbound', @@ -139,25 +158,26 @@ public function testThumbnail() { ]); $result = $this->Model->getImageSize(TMP . 'thumbnail.jpg'); - - $this->assertEquals($result, - [300, 300, 'x' => 300, 'y' => 300 - ]); + $this->assertEquals($result, [300, 300, 'x' => 300, 'y' => 300]); $this->Model->processImage($image, TMP . 'thumbnail2.jpg', [], [ - 'thumbnail' => [ - 'mode' => 'inset', - 'height' => 300, - 'width' => 300] + 'thumbnail' => [ + 'mode' => 'inset', + 'height' => 300, + 'width' => 300 + ] ] ); $result = $this->Model->getImageSize(TMP . 'thumbnail2.jpg'); - $this->assertEquals($result, - [226, 300, 'x' => 226, 'y' => 300 - ]); + $this->assertEquals($result, [226, 300, 'x' => 226, 'y' => 300]); } + /** + * testSquareCenterCrop + * + * @return void + */ public function testSquareCenterCrop() { $image = Plugin::path('Burzum/Imagine') . 'tests' . DS . 'Fixture' . DS . 'titus.jpg'; $this->Model->processImage($image, TMP . 'testSquareCenterCrop.jpg', [], [ @@ -165,65 +185,59 @@ public function testSquareCenterCrop() { 'size' => 255 ] ]); + $result = $this->Model->getImageSize(TMP . 'testSquareCenterCrop.jpg'); + $this->assertEquals($result, [255, 255, 'x' => 255, 'y' => 255]); } -/** - * testgetImageSize - * - * @return void - */ - public function testgetImageSize() { + /** + * testgetImageSize + * + * @return void + */ + public function testGetImageSize() { $image = Plugin::path('Burzum/Imagine') . 'tests' . DS . 'Fixture' . DS . 'titus.jpg'; $result = $this->Model->getImageSize($image); - $this->assertEquals($result, - [500, 664, 'x' => 500, 'y' => 664 - ]); + $this->assertEquals($result, [500, 664, 'x' => 500, 'y' => 664]); } - -/** - * testWidenAndHeighten - * - * @return void - */ + /** + * testWidenAndHeighten + * + * @return void + */ public function testWidenAndHeighten() { $image = Plugin::path('Burzum/Imagine') . 'tests' . DS . 'Fixture' . DS . 'titus.jpg'; $result = $this->Model->getImageSize($image); - $this->assertEquals($result, - [500, 664, 'x' => 500, 'y' => 664 - ]); + $this->assertEquals($result, [500, 664, 'x' => 500, 'y' => 664]); // Width - $this->Model->processImage($image, TMP . 'thumbnail2.jpg', [], [ + $this->Model->processImage($image, TMP . 'widen.jpg', [], [ 'widen' => [ 'size' => 200 ] ]); - $result = $this->Model->getImageSize(TMP . 'thumbnail2.jpg'); - $this->assertEquals($result, - [200, 266, 'x' => 200, 'y' => 266 - ]); + $result = $this->Model->getImageSize(TMP . 'widen.jpg'); + $this->assertEquals($result, [200, 266, 'x' => 200, 'y' => 266]); // Height - $this->Model->processImage($image, TMP . 'thumbnail3.jpg', [], [ - 'heighten' => [ - 'size' => 200] + $this->Model->processImage($image, TMP . 'heighten.jpg', [], [ + 'heighten' => [ + 'size' => 200 + ] ] ); $result = $this->Model->getImageSize(TMP . 'thumbnail3.jpg'); - $this->assertEquals($result, - [151, 200, 'x' => 151, 'y' => 200 - ]); + $this->assertEquals($result, [151, 200, 'x' => 151, 'y' => 200]); } -/** - * testScale - * - * @return void - */ + /** + * testScale + * + * @return void + */ public function testScale() { $image = Plugin::path('Burzum/Imagine') . 'tests' . DS . 'Fixture' . DS . 'titus.jpg'; @@ -235,8 +249,7 @@ public function testScale() { ]); $result = $this->Model->getImageSize(TMP . 'thumbnail4.jpg'); - $this->assertEquals($result, - [1000, 1328, 'x' => 1000, 'y' => 1328]); + $this->assertEquals($result, [1000, 1328, 'x' => 1000, 'y' => 1328]); // Scale2 $this->Model->processImage($image, TMP . 'thumbnail5.jpg', [], [ @@ -246,9 +259,6 @@ public function testScale() { ]); $result = $this->Model->getImageSize(TMP . 'thumbnail5.jpg'); - $this->assertEquals($result, - [625, 830, 'x' => 625, 'y' => 830 - ]); + $this->assertEquals($result, [625, 830, 'x' => 625, 'y' => 830]); } - -} \ No newline at end of file +}