Feature Request #4677

Image library should have an configuration option to define default_driver

Added by Alexander Alrusdi about 2 years ago. Updated about 2 years ago.

Status:NewStart date:12/14/2012
Priority:NormalDue date:
Assignee:-% Done:


Target version:-
Resolution: Points:1


This may be useful in situation when currently hardcoded default GD driver incorrectly working for given project.
Solutions in this case is change many Image::factory() calls to Image::factory(<my_better_driver>) or extend an Image library in way like this:

abstract class Image extends Kohana_Image {
    public static function factory($file, $driver = 'Imagick')
        return parent::factory($file, $driver);

Both solutions is probably not so good comparing to have a config variable image.default_driver (which can have default value "GD" to not break current code)


#1 Updated by Lorenzo Pisani about 2 years ago

Not sure we need a config call for this, you can set the default in your bootstrap.php file by doing Image::$default_driver = 'something'

#2 Updated by Alexander Alrusdi about 2 years ago

Oops, you right. Your solution is much productive.
It's time to close this task.

#3 Updated by Alexander Alrusdi about 2 years ago

Hm, wait. But if i will set the default driver in bootstrap.php then Image class will be loaded (by autoload function) every time when application starts. Also it will break litle bit module incapsulation (i mean it's theoreticaly better when all code related to one module is placed in specific this-one-module-related paths).
Also it's less intuitive. If someone wants to change default driver for image - he will look first into config first, then into docs, then into code of Image class, then ... mmm... bootstarp.php?

Also available in: Atom PDF