From 92a8473a9092ab27ad01395a27c47e2679f56d86 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 6 May 2020 19:45:09 +0200 Subject: [PATCH 1/3] added Slika as dependency --- composer.json | 3 +- composer.lock | 42 +- vendor/composer/autoload_psr4.php | 2 + vendor/composer/autoload_static.php | 10 + vendor/composer/installed.json | 42 + vendor/splitbrain/slika/.gitattributes | 4 + vendor/splitbrain/slika/.gitignore | 2 + vendor/splitbrain/slika/LICENSE | 7 + vendor/splitbrain/slika/README.md | 104 ++ vendor/splitbrain/slika/composer.json | 24 + vendor/splitbrain/slika/composer.lock | 1498 +++++++++++++++++ vendor/splitbrain/slika/src/Adapter.php | 87 + vendor/splitbrain/slika/src/Exception.php | 10 + vendor/splitbrain/slika/src/GdAdapter.php | 396 +++++ .../slika/src/ImageMagickAdapter.php | 124 ++ vendor/splitbrain/slika/src/Slika.php | 53 + 16 files changed, 2406 insertions(+), 2 deletions(-) create mode 100644 vendor/splitbrain/slika/.gitattributes create mode 100644 vendor/splitbrain/slika/.gitignore create mode 100644 vendor/splitbrain/slika/LICENSE create mode 100644 vendor/splitbrain/slika/README.md create mode 100644 vendor/splitbrain/slika/composer.json create mode 100644 vendor/splitbrain/slika/composer.lock create mode 100644 vendor/splitbrain/slika/src/Adapter.php create mode 100644 vendor/splitbrain/slika/src/Exception.php create mode 100644 vendor/splitbrain/slika/src/GdAdapter.php create mode 100644 vendor/splitbrain/slika/src/ImageMagickAdapter.php create mode 100644 vendor/splitbrain/slika/src/Slika.php diff --git a/composer.json b/composer.json index d4bb214f3..a2ae66485 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "openpsa/universalfeedcreator": "^1.8", "aziraphale/email-address-validator": "^2", "marcusschwarz/lesserphp": "^0.5.1", - "splitbrain/php-cli": "^1.1" + "splitbrain/php-cli": "^1.1", + "splitbrain/slika": "^1.0" }, "config": { "platform": { diff --git a/composer.lock b/composer.lock index 957486b29..f29a09211 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "dc3e894425a4e285b1c56c2ce4966a60", + "content-hash": "f43d3a0e0afb925e14da17a3b8323a29", "packages": [ { "name": "aziraphale/email-address-validator", @@ -516,6 +516,46 @@ "terminal" ], "time": "2019-12-12T08:24:54+00:00" + }, + { + "name": "splitbrain/slika", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/splitbrain/slika.git", + "reference": "a357f2ac6a10668c43516ef11220f60da9fab171" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/splitbrain/slika/zipball/a357f2ac6a10668c43516ef11220f60da9fab171", + "reference": "a357f2ac6a10668c43516ef11220f60da9fab171", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-gd": "PHP's builtin image manipulation library. Alternatively use an installation of ImageMagick" + }, + "type": "library", + "autoload": { + "psr-4": { + "splitbrain\\slika\\tests\\": "tests", + "splitbrain\\slika\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Gohr", + "email": "andi@splitbrain.org" + } + ], + "description": "Simple image resizing", + "time": "2020-09-01T15:14:41+00:00" } ], "packages-dev": [], diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 3a072f739..855f95f23 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -6,6 +6,8 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + 'splitbrain\\slika\\tests\\' => array($vendorDir . '/splitbrain/slika/tests'), + 'splitbrain\\slika\\' => array($vendorDir . '/splitbrain/slika/src'), 'splitbrain\\phpcli\\' => array($vendorDir . '/splitbrain/php-cli/src'), 'splitbrain\\PHPArchive\\' => array($vendorDir . '/splitbrain/php-archive/src'), 'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index db89c9eb9..7cc032707 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -15,6 +15,8 @@ class ComposerStaticInita19a915ee98347a0c787119619d2ff9b public static $prefixLengthsPsr4 = array ( 's' => array ( + 'splitbrain\\slika\\tests\\' => 23, + 'splitbrain\\slika\\' => 17, 'splitbrain\\phpcli\\' => 18, 'splitbrain\\PHPArchive\\' => 22, ), @@ -25,6 +27,14 @@ class ComposerStaticInita19a915ee98347a0c787119619d2ff9b ); public static $prefixDirsPsr4 = array ( + 'splitbrain\\slika\\tests\\' => + array ( + 0 => __DIR__ . '/..' . '/splitbrain/slika/tests', + ), + 'splitbrain\\slika\\' => + array ( + 0 => __DIR__ . '/..' . '/splitbrain/slika/src', + ), 'splitbrain\\phpcli\\' => array ( 0 => __DIR__ . '/..' . '/splitbrain/php-cli/src', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 821c3fa43..f6c8dda03 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -527,5 +527,47 @@ "optparse", "terminal" ] + }, + { + "name": "splitbrain/slika", + "version": "1.0.3", + "version_normalized": "1.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/splitbrain/slika.git", + "reference": "a357f2ac6a10668c43516ef11220f60da9fab171" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/splitbrain/slika/zipball/a357f2ac6a10668c43516ef11220f60da9fab171", + "reference": "a357f2ac6a10668c43516ef11220f60da9fab171", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-gd": "PHP's builtin image manipulation library. Alternatively use an installation of ImageMagick" + }, + "time": "2020-09-01T15:14:41+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "splitbrain\\slika\\tests\\": "tests", + "splitbrain\\slika\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Gohr", + "email": "andi@splitbrain.org" + } + ], + "description": "Simple image resizing" } ] diff --git a/vendor/splitbrain/slika/.gitattributes b/vendor/splitbrain/slika/.gitattributes new file mode 100644 index 000000000..b611adafe --- /dev/null +++ b/vendor/splitbrain/slika/.gitattributes @@ -0,0 +1,4 @@ +*.jpg filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.xcf filter=lfs diff=lfs merge=lfs -text +*.bmp filter=lfs diff=lfs merge=lfs -text diff --git a/vendor/splitbrain/slika/.gitignore b/vendor/splitbrain/slika/.gitignore new file mode 100644 index 000000000..e176a6519 --- /dev/null +++ b/vendor/splitbrain/slika/.gitignore @@ -0,0 +1,2 @@ +vendor/ +artefacts/ diff --git a/vendor/splitbrain/slika/LICENSE b/vendor/splitbrain/slika/LICENSE new file mode 100644 index 000000000..b91bdd1f2 --- /dev/null +++ b/vendor/splitbrain/slika/LICENSE @@ -0,0 +1,7 @@ +Copyright 2020 Andreas Gohr + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/splitbrain/slika/README.md b/vendor/splitbrain/slika/README.md new file mode 100644 index 000000000..c5ed69ee8 --- /dev/null +++ b/vendor/splitbrain/slika/README.md @@ -0,0 +1,104 @@ +# Slika - simple image handling for PHP + +This is a library that covers only the bare basics you need when handling images: + + * resizing + * cropping + * rotation + +It can use either PHP's libGD or a locally installed ImageMagick binary. + +## Installation + +Use composer + + composer require splitbrain/slika + +## Usage + +Simply get an Adapter from the Slika factory, run some operations on it and call `save`. + +Operations can be chained together. Consider the chain to be one command. Do not reuse the adapter returned by `run()`, it is a single use object. All operations can potentially throw a `\splitbrain\slika\Exception`. + +Options (see below) can be passed as a second parameter to the `run` factory. + +```php +use \splitbrain\slika\Slika; +use \splitbrain\slika\Exception; + +$options = [ + 'quality' => 75 +] + +try { + Slika::run('input.png', $options) + ->resize(500,500) + ->rotate(Slika::ROTATE_CCW + ->save('output.jpg', 'jpg'); +} catch (Exception $e) { + // conversion went wrong, handle it +} +``` + +## Operations + +### resize + +All resize operations will keep the original aspect ratio of the image. There will be no distortion. + +Keeping either width or height at zero will auto calculate the value for you. + +```php +# fit the image into a bounding box of 500x500 pixels +Slika::run('input.jpg')->resize(500,500)->save('output.png', 'png'); + +# adjust the image to a maximum width of 500 pixels +Slika::run('input.jpg')->resize(500,0)->save('output.png', 'png'); + +# adjust the image to a maximum height of 500 pixels +Slika::run('input.jpg')->resize(0,500)->save('output.png', 'png'); +``` + +### crop + +Similar to resizing, but this time the image will be cropped to fit the new aspect ratio. + +```php +Slika::run('input.jpg')->crop(500,500)->save('output.png', 'png'); +``` + +### rotate + +Rotates the image. The parameter passed is one of the EXIF orientation flags: + +![orientation flags](https://i.stack.imgur.com/BFqgu.gif) + +For your convenience there are three Constants defined: + + +* `Slika::ROTATE_CCW` counter clockwise rotation +* `Slika::ROTATE_CW` clockwise rotation +* `Slika::ROTATE_TOPDOWN` full 180 degree rotation + +```php +Slika::run('input.jpg')->rotate(Slika::ROTATE_CW)->save('output.png', 'png'); +``` + +### autorotate + +Rotates the image according to the EXIF rotation tag if found. + +```php +Slika::run('input.jpg')->autorotate()->save('output.png', 'png'); +``` + +## Options + +Options can be passed as associatiave array as the second parameter in `Slika::run`. + +The following options are availble currently: + +| Option | Default | Description | +|-------------|--------------------|--------------------------------------------| +| `imconvert` | `/usr/bin/convert` | The path to ImageMagick's `convert` binary | +| `quality` | `92` | The quality when writing JPEG images | diff --git a/vendor/splitbrain/slika/composer.json b/vendor/splitbrain/slika/composer.json new file mode 100644 index 000000000..8acd290a0 --- /dev/null +++ b/vendor/splitbrain/slika/composer.json @@ -0,0 +1,24 @@ +{ + "name": "splitbrain/slika", + "description": "Simple image resizing", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Andreas Gohr", + "email": "andi@splitbrain.org" + } + ], + "suggest": { + "ext-gd": "PHP's builtin image manipulation library. Alternatively use an installation of ImageMagick" + }, + "autoload": { + "psr-4": { + "splitbrain\\slika\\tests\\": "tests", + "splitbrain\\slika\\": "src" + } + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + } +} diff --git a/vendor/splitbrain/slika/composer.lock b/vendor/splitbrain/slika/composer.lock new file mode 100644 index 000000000..6957699fc --- /dev/null +++ b/vendor/splitbrain/slika/composer.lock @@ -0,0 +1,1498 @@ +{ + "_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#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "e6d04a08a3bf009f10b144e21fe4eb68", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.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://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2019-10-21T16:45:58+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.9.5", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2020-01-17T21:11:47+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "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": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2020-04-27T09:25:28+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "shasum": "" + }, + "require": { + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1" + }, + "require-dev": { + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2020-02-22T12:28:44+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", + "shasum": "" + }, + "require": { + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "^7.2", + "mockery/mockery": "~1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2020-02-18T18:59:58+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.10.3", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "451c3cd1418cf640de218914901e51b064abb093" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5 || ^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "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": "2020-03-05T15:02:03+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-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": "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": "2018-10-31T16:06:48+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "050bedf145a257b1ff02746c31894800e5122946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.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": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2018-09-13T20:33:42+00:00" + }, + { + "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-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-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": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2019-06-07T04:22:29+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-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": "2019-09-17T06:23:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.5.20", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-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": "2020-01-08T08:45:45+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "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": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-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": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-07-12T15:12:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-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", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2019-02-04T06:01:07+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-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": "2019-11-20T08:46:58+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2019-09-14T09:02:43+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.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": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.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": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.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": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.15-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-02-27T09:26:54+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2019-06-13T22:48:21+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6", + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "vimeo/psalm": "<3.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2020-04-18T12:12:48+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "1.1.0" +} diff --git a/vendor/splitbrain/slika/src/Adapter.php b/vendor/splitbrain/slika/src/Adapter.php new file mode 100644 index 000000000..29b9b613f --- /dev/null +++ b/vendor/splitbrain/slika/src/Adapter.php @@ -0,0 +1,87 @@ +imagepath = $imagepath; + $this->options = array_merge(Slika::DEFAULT_OPTIONS, $options); + } + + /** + * Rote the image based on the rotation exif tag + * + * @return Adapter + */ + abstract public function autorotate(); + + /** + * Rotate and/or flip the image + * + * This expects an orientation flag as stored in EXIF data. For typical operations, + * Slika::ROTATE_* constants are defined. + * + * @param int $orientation Exif rotation flags + * @return Adapter + * @see https://stackoverflow.com/a/53697440 for info on the rotation constants + */ + abstract public function rotate($orientation); + + /** + * Resize to make image fit the given dimension (maintaining the aspect ratio) + * + * You may omit one of the dimensions to auto calculate it based on the aspect ratio + * + * @param int $width + * @param int $height + * @return Adapter + */ + abstract public function resize($width, $height); + + + /** + * Resize to the given dimension, cropping the image as needed + * + * You may omit one of the dimensions to use a square area + * + * @param int $width + * @param int $height + * @return Adapter + */ + abstract public function crop($width, $height); + + /** + * Save the new file + * + * @param string $path + * @param string $extension The type of image to save, empty for original + * @return void + */ + abstract public function save($path, $extension = ''); + +} diff --git a/vendor/splitbrain/slika/src/Exception.php b/vendor/splitbrain/slika/src/Exception.php new file mode 100644 index 000000000..8db7f0686 --- /dev/null +++ b/vendor/splitbrain/slika/src/Exception.php @@ -0,0 +1,10 @@ +image = $this->loadImage($imagepath); + } + + /** + * Clean up + */ + public function __destruct() + { + if (is_resource($this->image)) { + imagedestroy($this->image); + } + } + + /** @inheritDoc + * @throws Exception + * @link https://gist.github.com/EionRobb/8e0c76178522bc963c75caa6a77d3d37#file-imagecreatefromstring_autorotate-php-L15 + */ + public function autorotate() + { + if ($this->extension !== 'jpeg') { + return $this; + } + + $orientation = 1; + + if (function_exists('exif_read_data')) { + // use PHP's exif capablities + $exif = exif_read_data($this->imagepath); + if (!empty($exif['Orientation'])) { + $orientation = $exif['Orientation']; + } + } else { + // grep the exif info from the raw contents + // we read only the first 70k bytes + $data = file_get_contents($this->imagepath, false, null, 0, 70000); + if (preg_match('@\x12\x01\x03\x00\x01\x00\x00\x00(.)\x00\x00\x00@', $data, $matches)) { + // Little endian EXIF + $orientation = ord($matches[1]); + } else if (preg_match('@\x01\x12\x00\x03\x00\x00\x00\x01\x00(.)\x00\x00@', $data, $matches)) { + // Big endian EXIF + $orientation = ord($matches[1]); + } + } + + return $this->rotate($orientation); + } + + /** + * @inheritDoc + * @throws Exception + */ + public function rotate($orientation) + { + $orientation = (int)$orientation; + if ($orientation < 0 || $orientation > 8) { + throw new Exception('Unknown rotation given'); + } + + if ($orientation <= 1) { + // no rotation wanted + return $this; + } + + // fill color + $transparency = imagecolorallocatealpha($this->image, 0, 0, 0, 127); + + // rotate + if (in_array($orientation, [3, 4])) { + $image = imagerotate($this->image, 180, $transparency, 1); + } + if (in_array($orientation, [5, 6])) { + $image = imagerotate($this->image, -90, $transparency, 1); + list($this->width, $this->height) = [$this->height, $this->width]; + } elseif (in_array($orientation, [7, 8])) { + $image = imagerotate($this->image, 90, $transparency, 1); + list($this->width, $this->height) = [$this->height, $this->width]; + } + /** @var resource $image is now defined */ + + // additionally flip + if (in_array($orientation, [2, 5, 7, 4])) { + imageflip($image, IMG_FLIP_HORIZONTAL); + } + + imagedestroy($this->image); + $this->image = $image; + + //keep png alpha channel if possible + if ($this->extension == 'png' && function_exists('imagesavealpha')) { + imagealphablending($this->image, false); + imagesavealpha($this->image, true); + } + + return $this; + } + + /** + * @inheritDoc + * @throws Exception + */ + public function resize($width, $height) + { + list($width, $height) = $this->boundingBox($width, $height); + $this->resizeOperation($width, $height); + return $this; + } + + /** + * @inheritDoc + * @throws Exception + */ + public function crop($width, $height) + { + list($this->width, $this->height, $offsetX, $offsetY) = $this->cropPosition($width, $height); + $this->resizeOperation($width, $height, $offsetX, $offsetY); + return $this; + } + + /** + * @inheritDoc + * @throws Exception + */ + public function save($path, $extension = '') + { + if ($extension === 'jpg') { + $extension = 'jpeg'; + } + if ($extension === '') { + $extension = $this->extension; + } + $saver = 'image' . $extension; + if (!function_exists($saver)) { + throw new Exception('Can not save image format ' . $extension); + } + + if ($extension == 'jpeg') { + imagejpeg($this->image, $path, $this->options['quality']); + } else { + $saver($this->image, $path); + } + + imagedestroy($this->image); + } + + /** + * Initialize libGD on the given image + * + * @param string $path + * @return resource + * @throws Exception + */ + protected function loadImage($path) + { + // Figure out the file info + $info = getimagesize($path); + if ($info === false) { + throw new Exception('Failed to read image information'); + } + $this->width = $info[0]; + $this->height = $info[1]; + + // what type of image is it? + $this->extension = image_type_to_extension($info[2], false); + $creator = 'imagecreatefrom' . $this->extension; + if (!function_exists($creator)) { + throw new Exception('Can not work with image format ' . $this->extension); + } + + // create the GD instance + $image = @$creator($path); + + if ($image === false) { + throw new Exception('Failed to load image wiht libGD'); + } + + return $image; + } + + /** + * Creates a new blank image to which we can copy + * + * Tries to set up alpha/transparency stuff correctly + * + * @param int $width + * @param int $height + * @return resource + * @throws Exception + */ + protected function createImage($width, $height) + { + // create a canvas to copy to, use truecolor if possible (except for gif) + $canvas = false; + if (function_exists('imagecreatetruecolor') && $this->extension != 'gif') { + $canvas = @imagecreatetruecolor($width, $height); + } + if (!$canvas) { + $canvas = @imagecreate($width, $height); + } + if (!$canvas) { + throw new Exception('Failed to create new canvas'); + } + + //keep png alpha channel if possible + if ($this->extension == 'png' && function_exists('imagesavealpha')) { + imagealphablending($canvas, false); + imagesavealpha($canvas, true); + } + + //keep gif transparent color if possible + if ($this->extension == 'gif' && function_exists('imagefill') && function_exists('imagecolorallocate')) { + if (function_exists('imagecolorsforindex') && function_exists('imagecolortransparent')) { + $transcolorindex = @imagecolortransparent($this->image); + if ($transcolorindex >= 0) { //transparent color exists + $transcolor = @imagecolorsforindex($this->image, $transcolorindex); + $transcolorindex = @imagecolorallocate( + $canvas, + $transcolor['red'], + $transcolor['green'], + $transcolor['blue'] + ); + @imagefill($canvas, 0, 0, $transcolorindex); + @imagecolortransparent($canvas, $transcolorindex); + } else { //filling with white + $whitecolorindex = @imagecolorallocate($canvas, 255, 255, 255); + @imagefill($canvas, 0, 0, $whitecolorindex); + } + } else { //filling with white + $whitecolorindex = @imagecolorallocate($canvas, 255, 255, 255); + @imagefill($canvas, 0, 0, $whitecolorindex); + } + } + + return $canvas; + } + + /** + * Calculate new size + * + * If widht and height are given, the new size will be fit within this bounding box. + * If only one value is given the other is adjusted to match according to the aspect ratio + * + * @param int $width width of the bounding box + * @param int $height height of the bounding box + * @return array (width, height) + * @throws Exception + */ + protected function boundingBox($width, $height) + { + if ($width == 0 && $height == 0) { + throw new Exception('You can not resize to 0x0'); + } + + if (!$height) { + // adjust to match width + $height = round(($width * $this->height) / $this->width); + } else if (!$width) { + // adjust to match height + $width = round(($height * $this->width) / $this->height); + } else { + // fit into bounding box + $scale = min($width / $this->width, $height / $this->height); + $width = $this->width * $scale; + $height = $this->height * $scale; + } + + return [$width, $height]; + } + + /** + * Calculates crop position + * + * Given the wanted final size, this calculates which exact area needs to be cut + * from the original image to be then resized to the wanted dimensions. + * + * @param int $width + * @param int $height + * @return array (cropWidth, cropHeight, offsetX, offsetY) + * @throws Exception + */ + protected function cropPosition($width, $height) + { + if ($width == 0 && $height == 0) { + throw new Exception('You can not crop to 0x0'); + } + + if (!$height) { + $height = $width; + } + + if (!$width) { + $width = $height; + } + + // calculate ratios + $oldRatio = $this->width / $this->height; + $newRatio = $width / $height; + + // calulate new size + if ($newRatio >= 1) { + if ($newRatio > $oldRatio) { + $cropWidth = $this->width; + $cropHeight = (int)($this->width / $newRatio); + } else { + $cropWidth = (int)($this->height * $newRatio); + $cropHeight = $this->height; + } + } else { + if ($newRatio < $oldRatio) { + $cropWidth = (int)($this->height * $newRatio); + $cropHeight = $this->height; + } else { + $cropWidth = $this->width; + $cropHeight = (int)($this->width / $newRatio); + } + } + + // calculate crop offset + $offsetX = (int)(($this->width - $cropWidth) / 2); + $offsetY = (int)(($this->height - $cropHeight) / 2); + + return [$cropWidth, $cropHeight, $offsetX, $offsetY]; + } + + /** + * resize or crop images using PHP's libGD support + * + * @param int $toWidth desired width + * @param int $toHeight desired height + * @param int $offsetX offset of crop centre + * @param int $offsetY offset of crop centre + * @throws Exception + */ + protected function resizeOperation($toWidth, $toHeight, $offsetX = 0, $offsetY = 0) + { + $newimg = $this->createImage($toWidth, $toHeight); + + //try resampling first, fall back to resizing + if ( + !function_exists('imagecopyresampled') || + !@imagecopyresampled( + $newimg, + $this->image, + 0, + 0, + $offsetX, + $offsetY, + $toWidth, + $toHeight, + $this->width, + $this->height + ) + ) { + imagecopyresized( + $newimg, + $this->image, + 0, + 0, + $offsetX, + $offsetY, + $toWidth, + $toHeight, + $this->width, + $this->height + ); + } + + // destroy original GD image ressource and replace with new one + imagedestroy($this->image); + $this->image = $newimg; + $this->width = $toWidth; + $this->height = $toHeight; + } + +} diff --git a/vendor/splitbrain/slika/src/ImageMagickAdapter.php b/vendor/splitbrain/slika/src/ImageMagickAdapter.php new file mode 100644 index 000000000..50527a894 --- /dev/null +++ b/vendor/splitbrain/slika/src/ImageMagickAdapter.php @@ -0,0 +1,124 @@ +options['imconvert'])) { + throw new Exception('Can not find or run ' . $this->options['imconvert']); + } + + $this->args[] = $this->options['imconvert']; + $this->args[] = $imagepath; + } + + /** @inheritDoc */ + public function autorotate() + { + $this->args[] = '-auto-orient'; + return $this; + } + + /** @inheritDoc */ + public function rotate($orientation) + { + $orientation = (int)$orientation; + if ($orientation < 0 || $orientation > 8) { + throw new Exception('Unknown rotation given'); + } + + // rotate + $this->args[] = '-rotate'; + if (in_array($orientation, [3, 4])) { + $this->args[] = '180'; + } elseif (in_array($orientation, [5, 6])) { + $this->args[] = '90'; + } elseif (in_array($orientation, [7, 8])) { + $this->args[] = '270'; + } + + // additionally flip + if (in_array($orientation, [2, 5, 7, 4])) { + $this->args[] = '-flop'; + } + return $this; + } + + /** + * @inheritDoc + * @throws Exception + */ + public function resize($width, $height) + { + if ($width == 0 && $height == 0) { + throw new Exception('You can not resize to 0x0'); + } + if ($width == 0) $width = ''; + if ($height == 0) $height = ''; + + $size = $width . 'x' . $height; + + $this->args[] = '-resize'; + $this->args[] = $size; + return $this; + } + + /** + * @inheritDoc + * @throws Exception + */ + public function crop($width, $height) + { + if ($width == 0 && $height == 0) { + throw new Exception('You can not crop to 0x0'); + } + + if ($width == 0) $width = $height; + if ($height == 0) $height = $width; + + $this->args[] = '-gravity'; + $this->args[] = 'center'; + $this->args[] = '-crop'; + $this->args[] = $width . 'x' . $height . '+0+0'; + $this->args[] = '+repage'; + return $this; + } + + /** + * @inheritDoc + * @throws Exception + */ + public function save($path, $extension = '') + { + if ($extension === 'jpg') { + $extension = 'jpeg'; + } + + $this->args[] = '-quality'; + $this->args[] = $this->options['quality']; + + if ($extension !== '') $path = $extension . ':' . $path; + $this->args[] = $path; + + $args = array_map('escapeshellarg', $this->args); + + $cmd = join(' ', $args); + $output = []; + $return = 0; + exec($cmd, $output, $return); + + if ($return !== 0) { + throw new Exception('ImageMagick returned non-zero exit code for ' . $cmd); + } + } +} diff --git a/vendor/splitbrain/slika/src/Slika.php b/vendor/splitbrain/slika/src/Slika.php new file mode 100644 index 000000000..122bfaa7f --- /dev/null +++ b/vendor/splitbrain/slika/src/Slika.php @@ -0,0 +1,53 @@ + 92, + 'imconvert' => '/usr/bin/convert', + ]; + + /** + * This is a factory only, thus the constructor is private + */ + private function __construct() + { + // there is no constructor. + } + + /** + * Start processing the image + * + * @param string $imagePath + * @param array $options + * @return Adapter + * @throws Exception + */ + public static function run($imagePath, $options = []) + { + $options = array_merge(self::DEFAULT_OPTIONS, $options); + + if (is_executable($options['imconvert'])) { + return new ImageMagickAdapter($imagePath, $options); + } + + if (function_exists('gd_info')) { + return new GdAdapter($imagePath, $options); + } + + throw new Exception('No suitable Adapter found'); + } + +} From d2bd34a5d99e196c6b46967293d14252e83f0c53 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 1 Sep 2020 18:02:20 +0200 Subject: [PATCH 2/3] use Slika for image resizing and cropping This replaces our own resize/crop function by the Slika library. This is not yet ideal, as there is quite a bit duplicated code between media_resize and media_crop now. Ideally these two should be replaced by a single method handling both. I'm just not sure where to best put it yet. Using Slika introduces two new features: * auto rotation based on EXIF #3059 * support for webp #3238 --- inc/media.php | 111 ++++++++++++++++++++------------------------------ 1 file changed, 45 insertions(+), 66 deletions(-) diff --git a/inc/media.php b/inc/media.php index 2f0a476ff..0cab2db24 100644 --- a/inc/media.php +++ b/inc/media.php @@ -2055,40 +2055,37 @@ function media_nstree_li($item){ */ function media_resize_image($file, $ext, $w, $h=0){ global $conf; - - $info = @getimagesize($file); //get original size - if($info == false) return $file; // that's no image - it's a spaceship! - - if(!$h) $h = round(($w * $info[1]) / $info[0]); - if(!$w) $w = round(($h * $info[0]) / $info[1]); - + if(!$h) $h = $w; // we wont scale up to infinity if($w > 2000 || $h > 2000) return $file; - // resize necessary? - (w,h) = native dimensions - if(($w == $info[0]) && ($h == $info[1])) return $file; - //cache $local = getCacheName($file,'.media.'.$w.'x'.$h.'.'.$ext); $mtime = @filemtime($local); // 0 if not exists - if($mtime > filemtime($file) || - media_resize_imageIM($ext, $file, $info[0], $info[1], $local, $w, $h) || - media_resize_imageGD($ext, $file, $info[0], $info[1], $local, $w, $h) - ) { - if($conf['fperm']) @chmod($local, $conf['fperm']); - return $local; + $options = [ + 'quality' => $conf['jpg_quality'], + 'imconvert' => $conf['im_convert'], + ]; + + if( $mtime > @filemtime($file) ) { + try { + \splitbrain\slika\Slika::run($file, $options) + ->autorotate() + ->resize($w, $h) + ->save($local, $ext); + if($conf['fperm']) @chmod($local, $conf['fperm']); + } catch (\splitbrain\slika\Exception $e) { + dbglog($e->getMessage()); + return $file; + } } - //still here? resizing failed - return $file; + + return $local; } /** - * Crops the given image to the wanted ratio, then calls media_resize_image to scale it - * to the wanted size - * - * Crops are centered horizontally but prefer the upper third of an vertical - * image because most pics are more interesting in that area (rule of thirds) + * Center crops the given image to the wanted size * * @author Andreas Gohr * @@ -2100,55 +2097,33 @@ function media_resize_image($file, $ext, $w, $h=0){ */ function media_crop_image($file, $ext, $w, $h=0){ global $conf; - if(!$h) $h = $w; - $info = @getimagesize($file); //get original size - if($info == false) return $file; // that's no image - it's a spaceship! - - // calculate crop size - $fr = $info[0]/$info[1]; - $tr = $w/$h; - - // check if the crop can be handled completely by resize, - // i.e. the specified width & height match the aspect ratio of the source image - if ($w == round($h*$fr)) { - return media_resize_image($file, $ext, $w); - } - - if($tr >= 1){ - if($tr > $fr){ - $cw = $info[0]; - $ch = (int) ($info[0]/$tr); - }else{ - $cw = (int) ($info[1]*$tr); - $ch = $info[1]; - } - }else{ - if($tr < $fr){ - $cw = (int) ($info[1]*$tr); - $ch = $info[1]; - }else{ - $cw = $info[0]; - $ch = (int) ($info[0]/$tr); - } - } - // calculate crop offset - $cx = (int) (($info[0]-$cw)/2); - $cy = (int) (($info[1]-$ch)/3); + // we wont scale up to infinity + if($w > 2000 || $h > 2000) return $file; //cache - $local = getCacheName($file,'.media.'.$cw.'x'.$ch.'.crop.'.$ext); - $mtime = @filemtime($local); // 0 if not exists + $local = getCacheName($file,'.media.'.$w.'x'.$h.'.crop.'.$ext); + $mtime = (int) @filemtime($local); // 0 if not exists - if( $mtime > @filemtime($file) || - media_crop_imageIM($ext,$file,$info[0],$info[1],$local,$cw,$ch,$cx,$cy) || - media_resize_imageGD($ext,$file,$cw,$ch,$local,$cw,$ch,$cx,$cy) ){ - if($conf['fperm']) @chmod($local, $conf['fperm']); - return media_resize_image($local,$ext, $w, $h); + $options = [ + 'quality' => $conf['jpg_quality'], + 'imconvert' => $conf['im_convert'], + ]; + + if( $mtime <= (int) @filemtime($file) ) { + try { + \splitbrain\slika\Slika::run($file, $options) + ->autorotate() + ->crop($w, $h) + ->save($local, $ext); + if($conf['fperm']) @chmod($local, $conf['fperm']); + } catch (\splitbrain\slika\Exception $e) { + dbglog($e->getMessage()); + return $file; + } } - //still here? cropping failed - return media_resize_image($file,$ext, $w, $h); + return $local; } /** @@ -2305,9 +2280,11 @@ function media_resize_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ * @param int $ofs_x offset of crop centre * @param int $ofs_y offset of crop centre * @return bool + * @deprecated 2020-09-01 */ function media_crop_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x,$ofs_y){ global $conf; + dbg_deprecated('splitbrain\\Slika'); // check if convert is configured if(!$conf['im_convert']) return false; @@ -2341,9 +2318,11 @@ function media_crop_imageIM($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x,$o * @param int $ofs_x offset of crop centre * @param int $ofs_y offset of crop centre * @return bool + * @deprecated 2020-09-01 */ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x=0,$ofs_y=0){ global $conf; + dbg_deprecated('splitbrain\\Slika'); if($conf['gdlib'] < 1) return false; //no GDlib available or wanted From 8bc1a7beb3e102da1017f312dffdda7c89326a5a Mon Sep 17 00:00:00 2001 From: John Brooks Date: Mon, 7 Sep 2020 21:17:24 +0000 Subject: [PATCH 3/3] media: Fix media_resize_image cache check The check was backwards, and it also caused a failure when there is no cache file (mtime=0) because the function would still return the path to the nonexistent cache file. --- inc/media.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/media.php b/inc/media.php index 0cab2db24..a1cb15ae2 100644 --- a/inc/media.php +++ b/inc/media.php @@ -2061,14 +2061,14 @@ function media_resize_image($file, $ext, $w, $h=0){ //cache $local = getCacheName($file,'.media.'.$w.'x'.$h.'.'.$ext); - $mtime = @filemtime($local); // 0 if not exists + $mtime = (int) @filemtime($local); // 0 if not exists $options = [ 'quality' => $conf['jpg_quality'], 'imconvert' => $conf['im_convert'], ]; - if( $mtime > @filemtime($file) ) { + if( $mtime <= (int) @filemtime($file) ) { try { \splitbrain\slika\Slika::run($file, $options) ->autorotate()