Skip to content

1.0.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@gchtr gchtr released this 22 Feb 07:23
· 3 commits to master since this release

This version comes packed with new features and introduces some breaking changes.

  • Fixed a bug when Timmy tried to resize files that it shouldn’t (video files for example).
  • Fixed issue when Timmy created upscaled image files even though it shouldn’t.
  • Added support for lazy loading with loading attribute.
  • Added width and height attributes for images by default to support browsers to calculate an aspect ratio.
  • Added support for WebP images.
  • Added support for getting Timmy image sizes with wp_get_attachment_image_src().
  • Added get_timber_image_alt() function.
  • Added get_timber_image_caption() function.
  • Added get_timber_image_description() function.
  • Added get_timber_picture_responsive() function.
  • Added get_timber_picture_fallback_image() function.
  • Added better support for SVG images. They will also receive width and height attributes if a size can be read from the SVG file.
  • Increased minimum supported PHP version to 7.4.
  • Increased required Timber version to 1.9.
  • Changed oversize configuration option naming from oversize to upscale. You can still use oversize, but it will be deprecated in the future.
  • Improved hints about controlling image sizes for Yoast.

Breaking changes

  • Changed additional parameters that are passed to the timber/src_default filter. There is no longer an array of additional $attributes to this filter, but only an instance of Timmy\Image.
  • Removed function pluggability. This means that you can’t overwrite any Timber functions anymore. If you want a similar functionality, you can copy the functions. They have way less logic in them than before, because a lot of the logic moved to the Timmy\Image class.
  • Removed get_post_thumbnail() and get_post_thumbnail_src() functions, because they are not namespaced with _timber_ as the other functions and are practically the same as get_timber_image() and get_timber_image_src().
  • Removed the title attribute from the <img> attributes, which was added by default with an image’s description. That approach was too opinionated and might only make sense in some use cases. If you still want to somehow use the image description, you can use the get_timber_image_description() function.
  • Removed deprecated get_image_attr_html(), get_timber_image_attr() and get_acf_image_attr() functions.

Changed how Timmy should be initialized.

🚫 Before

new Timmy\Timmy();

✅ After

Timmy\Timmy::init();

Changed how Responsive Content Images should be initialized

🚫 Before

new Timmy\Responsive_Content_Images()

✅ After

Timmy\Timmy::responsive_content_images();

New API behind the scenes

  • Added a new Timmy\Image class that is used to generate the markup for an image. Most of the functionality that was in the get_timber_*() functions before now lives in that class.
  • Added a Timmy\Timmy::get_image() function to get a Timmy\Image in a way that allows developers to extend the Timmy\Image class.

New documentation