WP Manifestindependent plugin directory
manifest / media / smart-media

Smart Media #4 in Media & Images

Smart Media enhancements for WordPress

★ 88stars
257kcomposer installs
0.5.13latest · 2d ago

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/humanmade/smart-media/archive/refs/heads/master.zip

On Packagist as humanmade/smart-media:

composer require humanmade/smart-media
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
Smart Media
Enhanced media library features for WordPress.
A Human Made project. Maintained by @roborourke.

Smarter media features for WordPress.

Some features in this plugin will work on their own however some are designed to augment the existing tools we use such as Tachyon.

Features

Justified media library

The media library shows square thumbnails by default which can make it harder to find the right image. This feature makes the thumbnails keep their original aspect ratio, similar to the UI of Flickr.

To disable the feature add the following:

<?php
add_filter( 'hm.smart-media.justified-library', '__return_false' );

Image editor

This feature overrides the built in WordPress image editing experience and gives you control over the crops of individual thumbs. There are also some UX improvements meaning there are fewer clicks required to make edits.

To disable the feature add the following:

<?php
add_filter( 'hm.smart-media.cropper', '__return_false' );

The image cropping UI provides support for updating Gutenberg block attributes based on the current selection using the following filters:

  • smartmedia.cropper.updateBlockAttributesOnSelect.<block name>
  • smartmedia.cropper.selectSizeFromBlockAttributes.<block name>

In the above filters <block name> should be replaced a dot separated version of your block name, for example core/image becomes core.image. The core image block attributes are mapped by default.

Mapping the selected image to block attributes:

addFilter(
  'smartmedia.cropper.updateBlockAttributesOnSelect.core.image',
  'smartmedia/cropper/update-block-on-select/core/image',
  /**
   * @param {?Object} attributes  The filtered block attributes. Return null to bypass updating.
   * @param {Object} image  The image data has the following shape:
   *   {
   *     name: <string>,  The image size name
   *     url: <string>,  The URL for the sized image
   *     width: <int>,  The width in pixels
   *     height: <int>,  The height in pixels
   *     label: <string>,  The human readable name for the image size, only present for user selectable sizes
   *     cropData: <?object>,  Null or object containing x, y, width and height properties
   *   }
   */
  ( attributes, image ) => {
    // Only user selectable image sizes have a label so return early if this is missing.
    if ( ! image.label ) {
      return attributes;
    }

    return {
      sizeSlug: image.size,
      url: image.url,
    };
  }
);

Update the cropping UI selected size based on selected block attributes:

addFilter(
  'smartmedia.cropper.selectSizeFromBlockAttributes.core.image',
  'smartmedia/cropper/select-size-from-block-attributes/core/image',
  /**
   * @param {?String} size  The image size slug.
   * @param {Object} block  The currently selected block.
   */
  ( size, block ) => {
    return size || block.attributes.sizeSlug || 'full';
  }
);

The function takes 2 parameters:

  • block: The name of the block to map attributes for
  • callback: A function that accepts the image size name, an image object containing url, width, height, crop data and label for the image size, and lastly the full attachment data object.

The callback should return an object or null. Passing null will prevent updating the currently selected block.

Roadmap

Planned features include:

  • Duplicate image detection and consolidation
  • EXIF data editor

Contributing

First of all thanks for using this plugin and thanks for contributing!

To get started check out the contributing documentation.

Releases

20 releases.

Tag
Published
0.5.13 latest
Oct 20, 2026 2d ago
Sep 11, 2025 1 year ago
Jul 31, 2025 1 year ago
Feb 14, 2025 1 year ago
Feb 7, 2025 1 year ago
Feb 7, 2025 1 year ago
Nov 27, 2024 1 year ago
Nov 27, 2024 1 year ago
Nov 13, 2024 1 year ago
Apr 22, 2024 2 years ago
Apr 9, 2024 2 years ago
Apr 9, 2024 2 years ago
Apr 9, 2024 2 years ago
Apr 3, 2024 2 years ago
Apr 3, 2024 2 years ago
Apr 2, 2024 2 years ago
Mar 21, 2023 3 years ago
Mar 21, 2023 3 years ago
Nov 22, 2022 3 years ago
Nov 22, 2022 3 years ago

These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.