burzum / cakephp-imagine-plugin

CakePHP wrapper for the powerful Imagine image processing library. Makes images manipulation easy and powerful.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resizing breaks when updating to 2.1.0

GuidoHendriks opened this issue · comments

After updating from 2.0.0 to 2.1.0, my images won't be resized any longer. They are saved for every size tho.

The config I'm using:

Configure::write('FileStorage', [
    'imageSizes' => [
        'Image' => [
            't200' => [
                'thumbnail' => [
                    'width' => 200,
                    'height' => 200
                ]
            ]
        ],
    ],
]);

Any idea what's going on or what I should check to make this work again?

There is an unit test for this feature.

https://github.com/burzum/cakephp-imagine-plugin/blob/master/tests/TestCase/Model/Behavior/ImagineBehaviorTest.php#L149

You can even disable the cleanup and check the generated image if the size is correct. Are there any errors or something else shown? Or is it just not creating the correct size?

OK, I can confirm it's an issue which I thought I have resolved.

See php-imagine/Imagine#478 this as well, their support is terrible slow.

But this doesn't seem to be a Imagine problem. The same version of it is used, only the version of this plugin is changed.

I'm more than happy if you can provide a better idea. I think it has something to do with the way the instance is passed around in the ImageProcessor lib vs the Behavior before.

Also, like I write in the ticket, this even happens with their very own tutorial code. Also I had do do the & reference in the old behavior to make this work for some weird reason. I'm pretty sure there is something wrong going on with the instance.

The issue is really weird, the unit tests for it work just fine. I've checked even the generated images manually if the size is really what I expect and it is correct.

@GuidoHendriks I can't do much about this I think.

See https://github.com/avalanche123/Imagine/blob/develop/lib/Imagine/Image/AbstractImage.php#L42

        // Won't work
        $thumbnail = $this->copy();
        // Works
        $thumbnail = $this;

Honestly, I have no idea why this was working before, nor why the copy is required here because it's not working when using copy().

@GuidoHendriks please try the 2.x branch, this commit d21f2e9, should fix the problem. It is still a workaround but I doubt Imagine is going to fix it any time soon. I still don't even understand the exact cause of the issue.