Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Class Image Missing extension() method?
  • Hi,
    I'm using the Image class to resize an Image in one of my applications.
    It seems that the Image class is missing the method extension(), which is reported in the docs:


    I solved adding the following code in the class Image (fuel\core\image.php):

    public static function extension()
    {
    return static::instance()->extension();
    }

    Is in fact an oversight or I'm missing something?

    Thanks for your help,
    TheDummyProgrammer


  • Not an oversight, the docs state it is not available with a static interface.

    As to the why, no idea, the Image class was largely a contribution. It seems the only method in the docs that has no static equivalent, so I agree with you this is an oversight, I'll add it.

    Having said this, it is better to avoid static calls, but load a driver object with an image using forge(), and then use method chaining.
  • p.s. the online docs are for the current release version, which is 1.8.1 at the moment.

    Code changes happen in the develop branch, the docs for develop can be found here: https://fuelphp.com/dev-docs/
  • Hi Harro,
    I followed your suggestion and used a driver object.
    Now I can use the method extension() without any modification to Fuel's core.

    Thanks again.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion