From ac752e5b3c8ee17dea1277a4595ce61436dbacc0 Mon Sep 17 00:00:00 2001 From: Andrew Coulton Date: Wed, 17 Sep 2014 17:38:26 +0100 Subject: [PATCH 1/6] Configure standalone travis build Adds and configures kohana/koharness to build a skeleton Kohana application and then uses that environment to run the unit tests on travis (and locally, if required). Continues kohana/kohana#50 --- .gitignore | 4 ++++ .travis.yml | 24 ++++++++++++++++++++++++ composer.json | 10 +++++++++- koharness.php | 8 ++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 koharness.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c359b56 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +composer.lock +vendor/* +koharness_bootstrap.php + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8f9e0fc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +language: php + +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - hhvm + +before_script: + - composer install --prefer-dist + - vendor/bin/koharness + +script: + - cd /tmp/koharness && ./vendor/bin/phpunit --bootstrap=modules/unittest/bootstrap.php modules/unittest/tests.php + +notifications: + irc: + channels: + - "irc.freenode.org#kohana" + template: + - "%{repository}/%{branch} (%{commit}) - %{author}: %{message}" + - "Build details: %{build_url}" + email: false diff --git a/composer.json b/composer.json index ed5cae4..a5c6049 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,11 @@ "kohana/core": ">=3.3", "php": ">=5.3.3" }, + "require-dev": { + "kohana/core": "3.3.*@dev", + "kohana/unittest": "3.3.*@dev", + "kohana/koharness": "*@dev" + }, "suggest": { "ext-gd": "*" }, @@ -31,6 +36,9 @@ "branch-alias": { "dev-3.3/develop": "3.3.x-dev", "dev-3.4/develop": "3.4.x-dev" - } + }, + "installer-paths": { + "vendor/{$vendor}/{$name}": ["type:kohana-module"] + } } } diff --git a/koharness.php b/koharness.php new file mode 100644 index 0000000..fc5e95a --- /dev/null +++ b/koharness.php @@ -0,0 +1,8 @@ + array( + 'image' => __DIR__, + 'unittest' => __DIR__ . '/vendor/kohana/unittest' + ), +); From f74d1825ac2acc02b209aaa86b10598e722853b8 Mon Sep 17 00:00:00 2001 From: Andrew Coulton Date: Mon, 22 Sep 2014 17:58:29 +0100 Subject: [PATCH 2/6] Disable IRC notifications for kohana builds --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f9e0fc..1313e37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,10 +15,4 @@ script: - cd /tmp/koharness && ./vendor/bin/phpunit --bootstrap=modules/unittest/bootstrap.php modules/unittest/tests.php notifications: - irc: - channels: - - "irc.freenode.org#kohana" - template: - - "%{repository}/%{branch} (%{commit}) - %{author}: %{message}" - - "Build details: %{build_url}" email: false From b31b929eac2c89c945dc0e8d4a9c691324cd0885 Mon Sep 17 00:00:00 2001 From: Andrew Coulton Date: Fri, 10 Oct 2014 15:38:27 +0100 Subject: [PATCH 3/6] Add travis build badges [skip ci] --- README.markdown | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.markdown b/README.markdown index e69de29..7e03525 100644 --- a/README.markdown +++ b/README.markdown @@ -0,0 +1,6 @@ +# Kohana - image processing module + +| ver | Stable | Develop | +|-------|--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------| +| 3.3.x | [![Build Status - 3.3/master](https://travis-ci.org/kohana/image.svg?branch=3.3%2Fmaster)](https://travis-ci.org/kohana/image) | [![Build Status - 3.3/develop](https://travis-ci.org/kohana/image.svg?branch=3.3%2Fdevelop)](https://travis-ci.org/kohana/image) | +| 3.4.x | [![Build Status - 3.4/master](https://travis-ci.org/kohana/image.svg?branch=3.4%2Fmaster)](https://travis-ci.org/kohana/image) | [![Build Status - 3.4/develop](https://travis-ci.org/kohana/image.svg?branch=3.4%2Fdevelop)](https://travis-ci.org/kohana/image) | From d6aeae6c975cc4d169deddaf9453e99d30caac01 Mon Sep 17 00:00:00 2001 From: alrusdi Date: Fri, 14 Dec 2012 16:29:47 +0600 Subject: [PATCH 4/6] refs #4677 Added a configuration option to define default driver for Image library --- classes/Kohana/Image.php | 5 +++-- config/image.php | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 config/image.php diff --git a/classes/Kohana/Image.php b/classes/Kohana/Image.php index 3fe91fc..27e0976 100644 --- a/classes/Kohana/Image.php +++ b/classes/Kohana/Image.php @@ -44,8 +44,9 @@ public static function factory($file, $driver = NULL) { if ($driver === NULL) { - // Use the default driver - $driver = Image::$default_driver; + // Use the driver from configuration file or default one + $configured_driver = Kohana::$config->load('image.default_driver'); + $driver = ($configured_driver) ? $configured_driver : Image::$default_driver; } // Set the class name diff --git a/config/image.php b/config/image.php new file mode 100644 index 0000000..6443264 --- /dev/null +++ b/config/image.php @@ -0,0 +1,6 @@ + 'Imagick', +); From 07618fe2847802006a214a6cf4b5a2cc44e4ff62 Mon Sep 17 00:00:00 2001 From: Andrew Coulton Date: Mon, 20 Oct 2014 11:11:09 +0100 Subject: [PATCH 5/6] Make the new default_driver configuration backwards-compatible Changed the default config value to NULL and added documentation of recommended and deprecated ways to configure which driver will be used. --- classes/Kohana/Image.php | 1 + config/image.php | 6 ++++-- guide/image/index.md | 21 +++++++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/classes/Kohana/Image.php b/classes/Kohana/Image.php index 27e0976..b67e6a6 100644 --- a/classes/Kohana/Image.php +++ b/classes/Kohana/Image.php @@ -23,6 +23,7 @@ abstract class Kohana_Image { const VERTICAL = 0x12; /** + * @deprecated - provide an image.default_driver value in your configuration instead * @var string default driver: GD, ImageMagick, etc */ public static $default_driver = 'GD'; diff --git a/config/image.php b/config/image.php index 6443264..2d8bb04 100644 --- a/config/image.php +++ b/config/image.php @@ -1,6 +1,8 @@ 'Imagick', + // Provide the default driver to use - eg a value of Imagick will use Image_Imagick as the driver class + // If you set a value for this config key, then the Image::$default_driver static variable that was used + // to configure earlier versions will be ignored. + 'default_driver' => NULL, ); diff --git a/guide/image/index.md b/guide/image/index.md index 0225c26..dd1e6b8 100644 --- a/guide/image/index.md +++ b/guide/image/index.md @@ -4,7 +4,24 @@ Kohana 3.x provides a simple yet powerful image manipulation module. The [Image] ## Drivers -[Image] module ships with [Image_GD] driver which requires `GD` extension enabled in your PHP installation. This is the default driver. Additional drivers can be created by extending the [Image] class. +[Image] module ships with [Image_GD] driver which requires `GD` extension enabled in your PHP installation, and +[Image_Imagick] driver which requires the `imagick` PHP extension. Additional drivers can be created by extending +the [Image] class. + +The [Image_GD] driver is the default. You can change this by providing an `image.default_driver` configuration option +- for example: + +~~~ +// application/config/image.php + 'Imagick' +); +~~~ + +[!!] Older versions of Kohana allowed you to configure the driver with the `Image::$default_driver` static variable in +the bootstrap, an extension class, or elsewhere. That variable is now deprecated and will be ignored if you set a +config value. ## Getting Started @@ -18,4 +35,4 @@ Kohana::modules(array( )); ~~~ -Next: [Using the image module](using). \ No newline at end of file +Next: [Using the image module](using). From c8d7dc42f751d4ce4819292c09cbf16dcc7a6004 Mon Sep 17 00:00:00 2001 From: Samuel Demirdjian Date: Fri, 28 Nov 2014 11:10:25 +0200 Subject: [PATCH 6/6] add jpe extension as IMAGETYPE_JPEG --- classes/Kohana/Image/GD.php | 1 + classes/Kohana/Image/Imagick.php | 1 + 2 files changed, 2 insertions(+) diff --git a/classes/Kohana/Image/GD.php b/classes/Kohana/Image/GD.php index e9c7988..5b52cab 100644 --- a/classes/Kohana/Image/GD.php +++ b/classes/Kohana/Image/GD.php @@ -611,6 +611,7 @@ protected function _save_function($extension, & $quality) switch (strtolower($extension)) { case 'jpg': + case 'jpe': case 'jpeg': // Save a JPG file $save = 'imagejpeg'; diff --git a/classes/Kohana/Image/Imagick.php b/classes/Kohana/Image/Imagick.php index 21adbbf..aa060c2 100644 --- a/classes/Kohana/Image/Imagick.php +++ b/classes/Kohana/Image/Imagick.php @@ -314,6 +314,7 @@ protected function _get_imagetype($extension) switch ($format) { case 'jpg': + case 'jpe': case 'jpeg': $type = IMAGETYPE_JPEG; break;