Skip to content

Releases: mindkomm/timmy

v0.13.0 - Filters!

24 Jan 13:49
Compare
Choose a tag to compare

Composer type

Changed Composer package type from wordpress-plugin to library.

With type wordpress-plugin, the package was installed into a wp-content/plugins folder, even if you used it in your theme. With type library, we follow that Timber does, and it’s still possible to define where the package should be installed. And it will not break backwards compatibility, because the default folder will still be the vendors folder.

Introducing filters

In the upcoming versions of Timmy you’ll see filters that allow you to change certain settings more easily. In this version, we introduce 3 new filters. To read more about the filters, there’s a new Filters section in the README. Here’s an overview over what these changes mean for you.

timmy/sizes

Introduced a new timmy/sizes filter to define the image sizes used in Timmy. The way to get image sizes through get_image_sizes() will be deprecated in a future version of Timmy. The reason for is that get_image_sizes() is quite a generic function name that could lead to conflicts with other plugins.

This means that instead of returning your image configuration from get_image_sizes(), you’ll use timmy/sizes:

DON’T USE

function get_image_sizes() {
    return array(
        // Image configuration
    );
}

USE

add_filter( 'timmy/sizes', function() {
    return array(
        // Image configuration
    );
} );

timmy/resize/ignore

  • Introduced a timmy/resize/ignore filter to make it possible to ignore resizing of images. This filter allows you to disable the resizing based on various conditions, that you can define yourself based on the values passed to this filter.
  • Added a default filter to ignore resizing of GIF images by default. If you still want to enable resizing of GIF images, you can disable the filter by adding the following line to functions.php of your theme (after you initialized Timmy with new Timmy\Timmy()):
remove_filter( 'timmy/resize/ignore', array( 'Timmy\Timmy', 'ignore_gif' ) );

timmy/generate_srcset_sizes

Introduced a new filter timmy/generate_srcset_sizes that filters whether srcset sizes should be generated when an image is uploaded. By default, Timmy generated sizes defined in srcset in your image configuration when you uploaded an image in the backend by default. You could disable this by using a generate_srcset_sizes in your image configuration. This behavior is now changed:

  • generate_srcset_sizes will be false by default. If you want a size to generate srcset sizes when an image is uploaded, you need to set generate_srcset_sizes for an image size to true.
  • If you want to enable generating srcset sizes for all images sizes, you can use the timmy/generate_srcset_sizes filter.
  • A value for generate_srcset_sizes set on an image size in your configuration will always overwrite values set by the filter.

v0.12.2

08 Jan 19:42
Compare
Choose a tag to compare

v0.12.1

17 Aug 09:19
Compare
Choose a tag to compare

Changed how Timmy is initialized. It now works the same as initializing Timber.
You need to initialize it manually in functions.php of your theme:

new Timmy\Timmy();

You can add this right after you called new Timber\Timber();.

This change was required to make the library more compatible with environments like Bedrock, where WordPress might not have been loaded when the Composer package is initialized.

Other changes

  • Fixed missing files when Timmy is installed as a plugin.
  • Fixed leading whitespace for srcset attributes.

v0.12.0

17 Aug 08:52
Compare
Choose a tag to compare
  • Added support for responsive content images, which means that Timmy can now make images inserted in the post content via the WordPress Editor responsive.
  • Optimized image markup by using the srcset attribute only if multiple images are available. If an image has only one image in srcset, it falls back to using the src attribute instead.
  • Added src fallback attribute to all responsive images by default to fix invalid markup errors (as recommended by Picturefill).
  • Optimized performance in the backend.
    • Only thumbnails and full sizes of images are shown in the backend to prevent on-the-fly resizing of images (e.g. in the Media Grid).
    • Uses full size instead of large size if 'large' is present as a size.
  • Fixed selectable images sizes that appear in various positions in the backend.
  • Added fallback for GIFs to return full size when image metadata can’t be read.
  • Internal: Introduced new helper class for static helper functions.
  • Internal: Replaced deprecated filter get_twig with timber/twig.

v0.11.0

27 Apr 06:24
Compare
Choose a tag to compare
  • Made Timmy compatible with newest version 1.3.0 of Timber, which is now also the minimum required version.
  • Added warning when key "full" is used in image size config.
  • Added warning when an image size does not exist in the image configuration.
  • Improved how Timmy selects the correct image source internally.
  • Improved how SVG and GIF images are handled. See the FAQ section for more information.
  • Improved how Timmy handles images it can’t find. Now, it will return false for all images it can’t find. This means that it will silently fail without any error messages.

v0.10.5

03 Jan 08:22
Compare
Choose a tag to compare
  • Fixed notice that occurred when oversize parameter was not set in image config.

v0.10.4

02 Jan 12:01
Compare
Choose a tag to compare
  • Fixed oversize parameter and updated documentation.

v0.10.3

18 Nov 13:11
Compare
Choose a tag to compare
  • Fixed an error when Timmy blocked images showing up in the Media Grid view in the backend.

v0.10.2

11 Oct 07:07
Compare
Choose a tag to compare
  • Optimized function get_timber_image_responsive_src() to directly return the image source when the image is an SVG or a GIF.

Composer support

25 May 18:16
Compare
Choose a tag to compare
  • Added composer.json to make it possible to load Timmy through Composer.
  • Added check for valid and non-empty TimberImage. Frontend functions now return an empty string when no image was found.
  • Made sure image arrays (like used in ACF) are also converted to a TimberImage. This way, it doesn’t matter if an image ID or an array is returned by ACF, Timmy will convert it to a TimberImage.