1.0.0-beta.1
Pre-release
Pre-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
andheight
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
andheight
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
toupscale
. You can still useoversize
, 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 ofTimmy\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()
andget_post_thumbnail_src()
functions, because they are not namespaced with_timber_
as the other functions and are practically the same asget_timber_image()
andget_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 theget_timber_image_description()
function. - Removed deprecated
get_image_attr_html()
,get_timber_image_attr()
andget_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 theget_timber_*()
functions before now lives in that class. - Added a
Timmy\Timmy::get_image()
function to get aTimmy\Image
in a way that allows developers to extend theTimmy\Image
class.