WordPress.org

Make WordPress Core

Changes between Version 3 and Version 4 of Ticket #46885, comment 2


Ignore:
Timestamp:
04/13/2019 06:40:51 AM (2 years ago)
Author:
pinktank
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #46885, comment 2

    v3 v4  
    77''A more graceful option would be to have the largest derivative first instead of the original src. This would still address the ios8 bug while providing a properly compressed image for better loading times and not freak out pagespeed.''
    88
    9 Alternatively somebody could add a filter snippet to the documentation, that maybe me, do I just do something like below? I don't know what I would put in ??? to check against src since the array has the filepaths.
    10 
    11 {{{
    12 // Parse through array to unset the original src
    13 foreach($sources as $elementKey => $element) {
    14     foreach($element as $width => $source) {
    15         if($source == ???){
    16             unset($array[$width]);
    17         }
    18     }
    19 }
    20 // Move largest derivative to first position.
    21 $largest_img_key = max(array_keys($sources));
    22 $sources = array( $largest_img_key => $sources[$largest_img_key]) + $sources;
    23 }}}
     9Alternatively somebody could add a filter snippet to the documentation, that maybe me
    2410 
    2511