[wp-trac] [WordPress Trac] #6814: Async media crunching

WordPress Trac noreply at wordpress.org
Thu May 23 18:39:31 UTC 2019


#6814: Async media crunching
----------------------------------+-----------------------------
 Reporter:  matt                  |       Owner:  koopersmith
     Type:  enhancement           |      Status:  assigned
 Priority:  normal                |   Milestone:  Future Release
Component:  Upload                |     Version:  2.5
 Severity:  normal                |  Resolution:
 Keywords:  blessed has-dev-note  |     Focuses:  performance
----------------------------------+-----------------------------

Comment (by ramon fincken):

 Ok so here we go .. sorry about no comments in code. We ship this at every
 customer as we see loads of folders from their local machines are just
 dragged and dropped to the media upload.

 It is used as as MU-plugin. Boot it by:
 {{{#!php
         include_once '/YOURDIR/thumbnails-
 later/managedwphosting_thumbnails_later.php';
         add_action('init' , 'ManagedWPHostingRegenerateThumbnails_Later');
 }}}


 The only thing I needed due to not be touching Core on this one is the
 flag MWP_THUMBSLATER_FLAG (defined). The define is just an extra pre-
 caution, I think it could be removed.

 So: it will **temporary remove the extra image sizes.**  (super low prio
 action flag 999) Therefore no extra images will be created based on the
 original upload. It sets a meta flag on the uploaded item.
 On each WP call, except a new upload the thumbs will be created.

 It is not said that this postmeta is the best in terms of optimization. A
 non-autoloaded option could also be used for this. However we use a batch
 limit in the SELECT clause.

 Parts of the code are based on the Regenerate thumbnails plugin by
 @viper007bond
 When checking the code right now I see that there might be a small hickup
 in the SQL query. What if the attachment is in trash? Not a big thing but
 stil.. waste of perfomance.

 If you have any questions feel free to ask now or at WCEU Berlin next
 month. I will be present at the contributor day.


 I will attach the PHP MU-plugin file in a sec.

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


More information about the wp-trac mailing list