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

WordPress Trac wp-trac at lists.automattic.com
Sat Dec 18 14:47:09 UTC 2010


#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  |
--------------------------+-----------------------------

Comment (by wlindley):

 I faced this problem some years ago and wrote the AutoNav plugin --
 http://wordpress.org/extend/plugins/autonav/ -- in response.

 However I took a different approach, parts of which might be valuable in
 core.  My plugin lets you specify a three sizes for thumbnails, depending
 on whether you want attachments or child pages listed in 2, 3, or 4
 columns (those numbers maybe changed in the admin) but when the page is
 actually displayed, the plugin looks through the directory to find
 candidate images that, say, fit in 200 pixels wide or 150 pixels tall.

 This plugin -- http://wordpress.org/extend/plugins/regenerate-thumbnails/
 -- recreates all thumbnails, but wastes much time remaking existing
 downsized images without checking whether it needs to (presumably, one
 could check existing file times and skip downsized images with timestamps
 after their parent).  The Wordpress database contains a list of image
 sizes for each attachment, created by wp's internal functions when the
 downsize functions create images for registered sizes; but this plugin
 blitzes that list and starts over.

 Any resize operation should ideally add information about what it did, to
 the list of image sizes associated with the attachment.  This should also
 include whether the downsize image was "fit" or "cropped" -- which isn't
 there now.

 The biggest challenge I see with any of these schemes is the disconnect
 between what's in the database and what's on disk.  A user could well
 hand-modify a particular attachment size to retouch the sharpness; how
 would we know not to overwrite it? An automatically-created downsized
 image for an "old" size might not be used anywhere on the site -- although
 we would probably have to somehow scan the text of every post to be sure!
 -- but can we delete an image without breaking possibly links on other
 sites?

 In short, how can we delete obsolete images to free space, without any way
 of knowing which imagess really are unused?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15311#comment:29>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list