Image icon indicating copy to clipboard operation
Image copied to clipboard

Custom filter

Open Ziiweb opened this issue 11 years ago • 7 comments

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..

Ziiweb avatar Apr 08 '14 10:04 Ziiweb

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

Gregwar avatar Apr 10 '14 07:04 Gregwar

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

Ziiweb avatar Apr 10 '14 07:04 Ziiweb

You just created a new class implementing AdapterInterface, right?

Gregwar avatar Apr 10 '14 07:04 Gregwar

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 avatar Apr 10 '14 07:04 Ziiweb

any help?

Ziiweb avatar Apr 11 '14 15:04 Ziiweb

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

Gregwar avatar Apr 11 '14 15:04 Gregwar

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?

Ziiweb avatar Apr 11 '14 15:04 Ziiweb