Description
The Picture Tag plugin allows you to easily integrate responsive <picture> tags into your WordPress site. It adds AVIF and WebP <source> elements for images that already exist on disk, with the original image as a fallback.
The plugin does not convert images itself. Use a conversion plugin such as WebP Express or CompressX, then set the paths to the converted files under “Settings > Picture Tag”. A source is added only if the converted file exists.
Features:
– A function for displaying images using the picture tag.
– Support for WebP and AVIF formats.
– Flexible settings for custom paths and image attributes.
– A shortcode [arti_picture] for inserting responsive tags with customizable attributes.
Installation
- Upload the plugin files to the
/wp-content/plugins/picture-tagdirectory or install it directly from the WordPress Plugin Repository. - Activate the plugin through the ‘Plugins’ menu in WordPress.
- Configure the settings under “Settings > Picture Tag”.
FAQ
Does this plugin convert images to WebP or AVIF?
No. Use a conversion plugin (for example WebP Express or CompressX) and set the paths to its output folders in “Settings > Picture Tag”.
Why don’t my WebP/AVIF images appear right after conversion?
The generated HTML is cached for two weeks (filter arti_picture_cache_duration). Click “Clear Image Cache” on the settings page after converting existing images. The cache is also cleared when the paths are changed or an attachment is edited.
Can I customize the generated “ tag?
Yes, the plugin provides options to configure custom paths and add attributes to images.
How do I use the shortcode?
Find the attachment ID of an image in Media > Library (it is shown in the URL when you edit the image), then use it in the shortcode:
[arti_picture id="123" size_1x="medium" size_2x="large" alt="Example screenshot" class="screenshot-image"]
Screenshots
Changelog
1.5.1
- Fix: AVIF/WebP files were not found on sites with a custom uploads or content directory.
- Fix: PHP warning when the
[arti_picture]shortcode is used without attributes. - Fix:
arti_the_image()removed thewidth,heightanddecodingattributes, causing layout shift. - Fix: clearing the cache of one attachment also cleared the cache of attachments with similar IDs.
- Fix: “Clear Image Cache” now works with persistent object caches (Redis, Memcached).
- The cache is now cleared automatically when the WebP or AVIF path is changed.
- An error message is shown when an invalid path is saved.
- Admin strings in the menu are now translatable.
- Plugin data is removed on uninstall.
- Tested with WordPress 7.1.
1.5.0
- Improved cache handling.
- Skip image processing during media uploads and media REST/AJAX requests.
- Use the original image MIME type for the fallback source.
1.4.2
- Fix warnings
1.4.1
- Fix fatal error
1.4
- Added improved caching system for better performance
- Implemented proper cache clearing when media is updated
- Added cache management tools in the admin interface
- Enhanced security with proper nonce verification
- Tested and confirmed compatibility with WordPress 6.8
1.3.1
- Improved performance by focusing only on local file operations
- Improved code readability with clearer documentation
- Fixed potential timeout issues when checking image formats
1.3.0
- Added support for custom data-* attributes in
[arti_picture]shortcode. - Added support for custom data-* attributes in the
arti_the_imagefunction.
1.2.0
- Added translation support for multilingual use.
- Improved text domain loading for better localization.
- Fixed minor bugs and enhanced compatibility with the latest WordPress versions.
1.1.1
- Update documentation.
1.1.0
- Refactoring of the plugin structure to improve the ease of maintenance.
- Added
[arti_picture]shortcode to display responsive<picture>tags. - Added documentation on the use of shortcodes.
1.0.0
- Initial release.
- Integrated WebP and AVIF format support.
