Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#25884 closed enhancement (duplicate)

Create media sizes when selected, not on initial upload

Reported by: drrobotnik's profile drrobotnik Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.7.1
Component: Media Keywords: dev-feedback
Focuses: Cc:

Description

Currently it's possible for plugins and themes to add_image_size for their unique uses. The unintended consequence is that these crops are applied to every image uploaded which causes an exponential amount of never used or seen media, thus very bloated upload folder.

There are few good alternatives to WP add_image_size. one method with the new WP 3.5 image editor, is to create the image crop when the image crop is requested. This works for custom sizes within template/plugin code. Here's the method I've been using.

The core change would be to adjust add_image_size to not create the image crops on user upload, but instead when the image is requested and actually used via the wp_get_attachment related functions. I believe implementing this way won't cause upgrading sites to break.

Looking forward to feedback on this.

Change History (3)

#1 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #15311.

#2 follow-up: @markoheijnen
11 years ago

Your method doesn't work fully. When an image got deleted your resized still exists. Check https://github.com/markoheijnen/WP_Image for something I build that can also do this.

#3 in reply to: ↑ 2 @drrobotnik
11 years ago

Thanks for this

Replying to markoheijnen:

Your method doesn't work fully. When an image got deleted your resized still exists. Check https://github.com/markoheijnen/WP_Image for something I build that can also do this.

Note: See TracTickets for help on using tickets.