media-command icon indicating copy to clipboard operation
media-command copied to clipboard

media regenerate removes/doesn't recreate custom site-icon sizes

Open dotsam opened this issue 7 years ago • 1 comments

Summary

When regenerating all media, the special-case site-icon loses its custom sizes

Steps to Reproduce

  1. Through Customizer -> Site Identity, add a Site Icon
  2. Observe that in addition to the originally uploaded image present in the media gallery, a 2nd "cropped" variant is created with unique image sizes
  3. Run wp media regenerate --yes
  4. Observe that the cropped variant's sizes are replaced with the standard active sizes

Environment

  1. PHP 7.1.16 (cli) (built: Mar 31 2018 02:28:54) ( NTS )
  2. $wp_version = '4.9.6';
  3. WP-CLI 1.5.1
  4. twentyseventeen theme, no plugins

Severity - Low

Expected Results: The special case 'site-icon' should be handled as it is in core to generate the correct media sizes

Actual Results: The site-icon image attachment is handled the same as all other uploads, and loses its special sizes, which may cause issues with devices/services looking for/expecting to find images of a particular size. The meta tags output in the site header do link to the newly generated image sizes, but attributes on the meta tags still show the original sizes that were expected to exist.

Core is only expecting this image to ever be set via the customizer, so the case for it is handled in ajax-actions.php which calls on the WP_Site_Icon class from class-wp-site-icon.php.

File and metadata before/after regeneration: https://gist.github.com/dotsam/f31dfed2ee1b64b149883520ee901b43

dotsam avatar Jun 22 '18 19:06 dotsam

We should include a hardcoded check for this edge case.

schlessera avatar Oct 03 '18 17:10 schlessera