From 07618fe2847802006a214a6cf4b5a2cc44e4ff62 Mon Sep 17 00:00:00 2001 From: Andrew Coulton Date: Mon, 20 Oct 2014 11:11:09 +0100 Subject: [PATCH] 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). -- 2.11.4.GIT