From 497d391412df070c65578e43a73c743458824d66 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 23 Jun 2021 13:59:35 +0545 Subject: [PATCH 1/3] update image library and gravity param --- app/controllers/api/storage.php | 2 +- composer.json | 2 +- composer.lock | 104 ++++++++++++++++---------------- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index c4fe8c8494..7cdcc3d0a8 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -242,7 +242,7 @@ App::get('/v1/storage/files/:fileId/preview') ->param('fileId', '', new UID(), 'File unique ID') ->param('width', 0, new Range(0, 4000), 'Resize preview image width, Pass an integer between 0 to 4000.', true) ->param('height', 0, new Range(0, 4000), 'Resize preview image height, Pass an integer between 0 to 4000.', true) - ->param('gravity', Image::GRAVITY_CENTER, new WhiteList([Image::GRAVITY_CENTER, Image::GRAVITY_NORTH, Image::GRAVITY_NORTHWEST, Image::GRAVITY_NORTHEAST, Image::GRAVITY_WEST, Image::GRAVITY_EAST, Image::GRAVITY_SOUTHWEST, Image::GRAVITY_SOUTH, Image::GRAVITY_SOUTHEAST]), 'Image crop gravity', true) + ->param('gravity', Image::GRAVITY_CENTER, new WhiteList([Image::GRAVITY_CENTER, Image::GRAVITY_TOP, Image::GRAVITY_TOP_LEFT, Image::GRAVITY_TOP_RIGHT, Image::GRAVITY_LEFT, Image::GRAVITY_RIGHT, Image::GRAVITY_BOTTOM_LEFT, Image::GRAVITY_BOTTOM, Image::GRAVITY_BOTTOM_RIGHT]), 'Image crop gravity', true) ->param('quality', 100, new Range(0, 100), 'Preview image quality. Pass an integer between 0 to 100. Defaults to 100.', true) ->param('borderWidth', 0, new Range(0, 100), 'Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.', true) ->param('borderColor', '', new HexColor(), 'Preview image border color. Use a valid HEX color, no # is needed for prefix.', true) diff --git a/composer.json b/composer.json index 77a118a8dd..c665fb24b4 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "utopia-php/domains": "1.1.*", "utopia-php/swoole": "0.2.*", "utopia-php/storage": "0.5.*", - "utopia-php/image": "0.3.*", + "utopia-php/image": "0.4.*", "resque/php-resque": "1.3.6", "matomo/device-detector": "4.2.2", "dragonmantank/cron-expression": "3.1.0", diff --git a/composer.lock b/composer.lock index 1d655a0c29..07e32249b1 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": "1619af9dd64477ba255e6f47bdf2ac51", + "content-hash": "75b472aae18938c8f7f3675395ca7c2f", "packages": [ { "name": "adhocore/jwt", @@ -1742,16 +1742,16 @@ }, { "name": "utopia-php/image", - "version": "0.3.2", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/utopia-php/image.git", - "reference": "2044fdd44d87c4253cfe929cca975fd037461b00" + "reference": "63d8d8df59828db8e44a40acfe3ca50af9f0c35f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/image/zipball/2044fdd44d87c4253cfe929cca975fd037461b00", - "reference": "2044fdd44d87c4253cfe929cca975fd037461b00", + "url": "https://api.github.com/repos/utopia-php/image/zipball/63d8d8df59828db8e44a40acfe3ca50af9f0c35f", + "reference": "63d8d8df59828db8e44a40acfe3ca50af9f0c35f", "shasum": "" }, "require": { @@ -1789,9 +1789,9 @@ ], "support": { "issues": "https://github.com/utopia-php/image/issues", - "source": "https://github.com/utopia-php/image/tree/0.3.2" + "source": "https://github.com/utopia-php/image/tree/0.4.0" }, - "time": "2021-06-10T09:16:11+00:00" + "time": "2021-06-23T07:43:36+00:00" }, { "name": "utopia-php/locale", @@ -2003,16 +2003,16 @@ }, { "name": "utopia-php/swoole", - "version": "0.2.3", + "version": "0.2.4", "source": { "type": "git", "url": "https://github.com/utopia-php/swoole.git", - "reference": "45c42aae7e7d3f9f82bf194c2cfa5499b674aefe" + "reference": "37d8c64b536d6bc7da4f0f5a934a0ec44885abf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/swoole/zipball/45c42aae7e7d3f9f82bf194c2cfa5499b674aefe", - "reference": "45c42aae7e7d3f9f82bf194c2cfa5499b674aefe", + "url": "https://api.github.com/repos/utopia-php/swoole/zipball/37d8c64b536d6bc7da4f0f5a934a0ec44885abf4", + "reference": "37d8c64b536d6bc7da4f0f5a934a0ec44885abf4", "shasum": "" }, "require": { @@ -2053,9 +2053,9 @@ ], "support": { "issues": "https://github.com/utopia-php/swoole/issues", - "source": "https://github.com/utopia-php/swoole/tree/0.2.3" + "source": "https://github.com/utopia-php/swoole/tree/0.2.4" }, - "time": "2021-03-22T22:39:24+00:00" + "time": "2021-06-22T10:49:24+00:00" }, { "name": "utopia-php/system", @@ -2713,20 +2713,20 @@ }, { "name": "felixfbecker/advanced-json-rpc", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", - "reference": "06f0b06043c7438959dbdeed8bb3f699a19be22e" + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/06f0b06043c7438959dbdeed8bb3f699a19be22e", - "reference": "06f0b06043c7438959dbdeed8bb3f699a19be22e", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", "shasum": "" }, "require": { - "netresearch/jsonmapper": "^1.0 || ^2.0", + "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "php": "^7.1 || ^8.0", "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" }, @@ -2752,9 +2752,9 @@ "description": "A more advanced JSONRPC implementation", "support": { "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", - "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.0" + "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" }, - "time": "2021-01-10T17:48:47+00:00" + "time": "2021-06-11T22:34:44+00:00" }, { "name": "felixfbecker/language-server-protocol", @@ -3003,16 +3003,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v2.1.0", + "version": "v4.0.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e" + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/e0f1e33a71587aca81be5cffbb9746510e1fe04e", - "reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", "shasum": "" }, "require": { @@ -3020,10 +3020,10 @@ "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", - "php": ">=5.6" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4 || ~7.0", + "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0", "squizlabs/php_codesniffer": "~3.5" }, "type": "library", @@ -3048,9 +3048,9 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/master" + "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0" }, - "time": "2020-04-16T18:48:43+00:00" + "time": "2020-12-01T19:48:11+00:00" }, { "name": "nikic/php-parser", @@ -4472,16 +4472,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.2", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", "shasum": "" }, "require": { @@ -4524,7 +4524,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" }, "funding": [ { @@ -4532,7 +4532,7 @@ "type": "github" } ], - "time": "2020-10-26T15:55:19+00:00" + "time": "2021-06-11T13:31:12+00:00" }, { "name": "sebastian/lines-of-code", @@ -4823,16 +4823,16 @@ }, { "name": "sebastian/type", - "version": "2.3.2", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "0d1c587401514d17e8f9258a27e23527cb1b06c1" + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0d1c587401514d17e8f9258a27e23527cb1b06c1", - "reference": "0d1c587401514d17e8f9258a27e23527cb1b06c1", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", "shasum": "" }, "require": { @@ -4867,7 +4867,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.2" + "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" }, "funding": [ { @@ -4875,7 +4875,7 @@ "type": "github" } ], - "time": "2021-06-04T13:02:07+00:00" + "time": "2021-06-15T12:49:02+00:00" }, { "name": "sebastian/version", @@ -4984,16 +4984,16 @@ }, { "name": "symfony/console", - "version": "v5.3.0", + "version": "v5.3.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "058553870f7809087fa80fa734704a21b9bcaeb2" + "reference": "649730483885ff2ca99ca0560ef0e5f6b03f2ac1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/058553870f7809087fa80fa734704a21b9bcaeb2", - "reference": "058553870f7809087fa80fa734704a21b9bcaeb2", + "url": "https://api.github.com/repos/symfony/console/zipball/649730483885ff2ca99ca0560ef0e5f6b03f2ac1", + "reference": "649730483885ff2ca99ca0560ef0e5f6b03f2ac1", "shasum": "" }, "require": { @@ -5062,7 +5062,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.0" + "source": "https://github.com/symfony/console/tree/v5.3.2" }, "funding": [ { @@ -5078,7 +5078,7 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2021-06-12T09:42:48+00:00" }, { "name": "symfony/deprecation-contracts", @@ -5635,16 +5635,16 @@ }, { "name": "symfony/string", - "version": "v5.3.0", + "version": "v5.3.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "a9a0f8b6aafc5d2d1c116dcccd1573a95153515b" + "reference": "0732e97e41c0a590f77e231afc16a327375d50b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/a9a0f8b6aafc5d2d1c116dcccd1573a95153515b", - "reference": "a9a0f8b6aafc5d2d1c116dcccd1573a95153515b", + "url": "https://api.github.com/repos/symfony/string/zipball/0732e97e41c0a590f77e231afc16a327375d50b0", + "reference": "0732e97e41c0a590f77e231afc16a327375d50b0", "shasum": "" }, "require": { @@ -5698,7 +5698,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.0" + "source": "https://github.com/symfony/string/tree/v5.3.2" }, "funding": [ { @@ -5714,7 +5714,7 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2021-06-06T09:51:56+00:00" }, { "name": "theseer/tokenizer", From 378be8363ab91637a6c0e853c1161d56187f28c3 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 24 Jun 2021 12:15:52 +0545 Subject: [PATCH 2/3] using getGravityTypes method to get list of supported gravity --- app/controllers/api/storage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 7cdcc3d0a8..3adb031048 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -242,7 +242,7 @@ App::get('/v1/storage/files/:fileId/preview') ->param('fileId', '', new UID(), 'File unique ID') ->param('width', 0, new Range(0, 4000), 'Resize preview image width, Pass an integer between 0 to 4000.', true) ->param('height', 0, new Range(0, 4000), 'Resize preview image height, Pass an integer between 0 to 4000.', true) - ->param('gravity', Image::GRAVITY_CENTER, new WhiteList([Image::GRAVITY_CENTER, Image::GRAVITY_TOP, Image::GRAVITY_TOP_LEFT, Image::GRAVITY_TOP_RIGHT, Image::GRAVITY_LEFT, Image::GRAVITY_RIGHT, Image::GRAVITY_BOTTOM_LEFT, Image::GRAVITY_BOTTOM, Image::GRAVITY_BOTTOM_RIGHT]), 'Image crop gravity', true) + ->param('gravity', Image::GRAVITY_CENTER, new WhiteList(Image::getGravityTypes()), 'Image crop gravity. Can be one of ' . implode(",", Image::getGravityTypes()), true) ->param('quality', 100, new Range(0, 100), 'Preview image quality. Pass an integer between 0 to 100. Defaults to 100.', true) ->param('borderWidth', 0, new Range(0, 100), 'Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.', true) ->param('borderColor', '', new HexColor(), 'Preview image border color. Use a valid HEX color, no # is needed for prefix.', true) From 66a6c404336f6c9b3e9731e6ca51ae9329f9def7 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 25 Jun 2021 12:36:03 +0545 Subject: [PATCH 3/3] update image library --- composer.json | 2 +- composer.lock | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index c665fb24b4..17b5500ff4 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "utopia-php/domains": "1.1.*", "utopia-php/swoole": "0.2.*", "utopia-php/storage": "0.5.*", - "utopia-php/image": "0.4.*", + "utopia-php/image": "0.5.*", "resque/php-resque": "1.3.6", "matomo/device-detector": "4.2.2", "dragonmantank/cron-expression": "3.1.0", diff --git a/composer.lock b/composer.lock index 07e32249b1..308f144965 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": "75b472aae18938c8f7f3675395ca7c2f", + "content-hash": "a03cb89925d6bda5ad4248699f732a6a", "packages": [ { "name": "adhocore/jwt", @@ -1324,16 +1324,16 @@ }, { "name": "utopia-php/abuse", - "version": "0.4.1", + "version": "0.4.2", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "8b7973aae4b02489bd22ffea45b985608f13b6d9" + "reference": "286b52209818e5033573e6441d65adbc48a6f715" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/8b7973aae4b02489bd22ffea45b985608f13b6d9", - "reference": "8b7973aae4b02489bd22ffea45b985608f13b6d9", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/286b52209818e5033573e6441d65adbc48a6f715", + "reference": "286b52209818e5033573e6441d65adbc48a6f715", "shasum": "" }, "require": { @@ -1370,9 +1370,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.4.1" + "source": "https://github.com/utopia-php/abuse/tree/0.4.2" }, - "time": "2021-06-05T14:31:33+00:00" + "time": "2021-06-23T15:04:44+00:00" }, { "name": "utopia-php/analytics", @@ -1431,21 +1431,21 @@ }, { "name": "utopia-php/audit", - "version": "0.5.1", + "version": "0.5.2", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "154a850170a58667a15e4b65fbabb6cd0b709dd9" + "reference": "57e4f8f932164bdfd48ec32bf8d7d3f1bf7518e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/154a850170a58667a15e4b65fbabb6cd0b709dd9", - "reference": "154a850170a58667a15e4b65fbabb6cd0b709dd9", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/57e4f8f932164bdfd48ec32bf8d7d3f1bf7518e4", + "reference": "57e4f8f932164bdfd48ec32bf8d7d3f1bf7518e4", "shasum": "" }, "require": { "ext-pdo": "*", - "php": ">=7.1" + "php": ">=7.4" }, "require-dev": { "phpunit/phpunit": "^9.3", @@ -1477,9 +1477,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.5.1" + "source": "https://github.com/utopia-php/audit/tree/0.5.2" }, - "time": "2020-12-21T17:28:53+00:00" + "time": "2021-06-23T16:02:40+00:00" }, { "name": "utopia-php/cache", @@ -1742,16 +1742,16 @@ }, { "name": "utopia-php/image", - "version": "0.4.0", + "version": "0.5.0", "source": { "type": "git", "url": "https://github.com/utopia-php/image.git", - "reference": "63d8d8df59828db8e44a40acfe3ca50af9f0c35f" + "reference": "5b4ac25e70a95fa10b39c129b742ac66748d40b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/image/zipball/63d8d8df59828db8e44a40acfe3ca50af9f0c35f", - "reference": "63d8d8df59828db8e44a40acfe3ca50af9f0c35f", + "url": "https://api.github.com/repos/utopia-php/image/zipball/5b4ac25e70a95fa10b39c129b742ac66748d40b8", + "reference": "5b4ac25e70a95fa10b39c129b742ac66748d40b8", "shasum": "" }, "require": { @@ -1789,9 +1789,9 @@ ], "support": { "issues": "https://github.com/utopia-php/image/issues", - "source": "https://github.com/utopia-php/image/tree/0.4.0" + "source": "https://github.com/utopia-php/image/tree/0.5.0" }, - "time": "2021-06-23T07:43:36+00:00" + "time": "2021-06-25T03:40:03+00:00" }, { "name": "utopia-php/locale",