mindkomm / timmy

Advanced image handling for Timber.
MIT License
171 stars 13 forks source link

Regenerate thumbnails throws errors when timmy is enabled #16

Closed idflood closed 6 years ago

idflood commented 6 years ago

After enabling Timmy if I try to run regnerate thumbnails it gives this error for all attachments:

Skipped Attachment ID 42: SyntaxError: Unexpected token < in JSON at position 0

When inspecting the network activity from the browser I see that it try to get one "json" by attachament and it gives some notices, which are printed by xdebug, which in turn it eventually make the json invalid.

Here are some of the notices printed:

Notice: Undefined index: width in /.../wp-content/plugins/regenerate-thumbnails/includes/class-regeneratethumbnails-regenerator.php on line 626
...

12 | 0.1174 | 12462976 | RegenerateThumbnails_REST_Controller->regenerate_item( ) | .../class-wp-rest-server.php:936
-- | -- | -- | -- | --
13 | 2.7582 | 15143840 | RegenerateThumbnails_REST_Controller->attachment_info( ) | .../class-regeneratethumbnails-rest-controller.php:206
14 | 2.7582 | 15144384 | RegenerateThumbnails_Regenerator->get_attachment_info( ) | .../class-regeneratethumbnails-rest-controller.php:226

There is also the same notice for the indexes height and crop

idflood commented 6 years ago

Sorry, it was caused because I added the filter in the after_setup_theme hook. After adding that to the root of the function php everything worked :)