Gregwar / Image

A PHP library to handle images
MIT License
1k stars 191 forks source link

Custom filter #52

Open Ziiweb opened 10 years ago

Ziiweb commented 10 years ago

I would like to create a custom filter so I have this:

abstract class Adapter implements AdapterInterface
{
//....
    private function myFilter()
    {
        die("Entering in my myFilter");
        $this->negate();
        $this->sepia();
    }
}

I have this code in my view:

src="{{ image('images/' ~ producto.imageName).myFilter

but Entering in myFilter is never shown..

Gregwar commented 10 years ago

Hello You have to change the adapter used by the image to do such things

Ziiweb commented 10 years ago

thanks, but what do you mean exactly? what should I change in the adapter? why it is not entering to the adapter myFilter?

Gregwar commented 10 years ago

You just created a new class implementing AdapterInterface, right?

Ziiweb commented 10 years ago

no, by the moment (just to check if the filter works) I added myFilter() to this class: https://github.com/Gregwar/Image/blob/master/Adapter/AdapterInterface.php

Ziiweb commented 10 years ago

any help?

Gregwar commented 10 years ago

You mean you wrote it in the base Adapter class? Your method should be public

Ziiweb commented 10 years ago

I have changed the function to public:

public function myFilter()
{
    die("jfkasld");
    $this->negate();
    $this->sepia();
}

but it still not entering to it, since "jfkasld" is not shown.

I have tried to add it to Adapter.php and Common.php.

Any example that shows what I'm trying to get?