matjazpotocnik / AutoSmush

Automatically optimize images on upload/resize/crop. Manual and bulk optimization.
MIT License
11 stars 0 forks source link

Optimize on resize/crop (variations) doesn't function #2

Closed iangregory closed 5 years ago

iangregory commented 6 years ago

I have AutoSmush configured only to optimize on resize/crop (variations). However, I can see from the logs that this does't work - the images are never optimized.

Having reviewed the code it appears that the hook is being added on line 1256 in the ready() function.

However, we return earlier in that function (line 1207) if the page is not an admin page, so the hook is never added.

Commenting out line 1207 causes images to be smushed when they're resized (i.e. on first load) as expected.

matjazpotocnik commented 6 years ago

Hm, it's working here. Could you enable debug mode and see if the hook is applied? Also please add

$this->log->save($page->template->name);

before line 1207, just to check what is the template name.

iangregory commented 6 years ago

Debug mode indicates the hook isn't being applied. The template name is 'home'

2018-01-16 21:00:22 home

matjazpotocnik commented 6 years ago

Hmm... How do you create variations? Could you also log $page->process?

matjazpotocnik commented 5 years ago

This is fixed in 1.1.4.