[wp-trac] [WordPress Trac] #15311: dynamic image resize (on the fly) using already available functions

WordPress Trac noreply at wordpress.org
Sat Jan 10 12:31:46 UTC 2015


#15311: dynamic image resize (on the fly) using already available functions
------------------------------------+-----------------------------
 Reporter:  vteixeira               |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Future Release
Component:  Media                   |     Version:  3.1
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+-----------------------------

Comment (by markoheijnen):

 @Eric: is [attachment:15311.5.diff​] the right patch? I don't see a unit
 tests.

 I believe it has some utilities if people do want to enable resizing on
 the fly. That said, your patch should include a way to be able to load the
 requested image since WordPress will skip an image size when it doesn't
 exist and search for the closest best. The benefit of
 [attachment:15311.5.diff​] is that the page request isn't slowed down.
 Unsure about possible breakage when rewrite rules aren't correct (as in
 ignoring when extension has been passed).

 Your first reasoning is right but the code doesn't reflect that. You now
 put it in `image_downsize()` like drrobotnick did. I put it in
 `image_get_intermediate_size()` since that function gets requested by
 `image_downsize()`. So if plugin developers would call that instead
 everything still is fine.

 Personally I like my approach better where I only generating the missing
 image and not regenerate everything which is what
 `wp_generate_attachment_metadata()` does.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/15311#comment:104>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list