Created
          September 5, 2019 11:59 
        
      - 
      
- 
        Save lilumi/26139e6d8fe98ff514d8c24773a9ea2a to your computer and use it in GitHub Desktop. 
    IE10 IE9 IE8 gray filter using inline generated svg
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| $thumbnail_id = get_post_thumbnail_id(); | |
| $thumbnail_url = get_the_post_thumbnail_url( get_the_ID(), $thumb_size ); | |
| $html .= '<div '.qode_get_inline_style($overlay_styles).' class="portfolio_shader"></div>'; | |
| $html .= '<div class="image_holder">'; | |
| $html .= '<span class="image">'; | |
| if ((preg_match('/MSIE\s(?P<v>\d+)/i', @$_SERVER['HTTP_USER_AGENT'], $A) && $A['v'] <= 11) || preg_match('/Trident/i', @$_SERVER['HTTP_USER_AGENT'], $B)) { | |
| $html .= '<svg xmlns="http://www.w3.org/2000/svg" id="svgroot-' . $thumbnail_id . '" viewBox="0 0 476 401" width="476" height="401" style="background-image:url(' . $thumbnail_url . ')"> | |
| <defs> | |
| <filter id="filtersPicture-' . $thumbnail_id . '"> | |
| <feComposite result="inputTo_' . $thumbnail_id . '" in="SourceGraphic" in2="SourceGraphic" operator="arithmetic" k1="0" k2="1" k3="0" k4="0" /> | |
| <feColorMatrix id="filter_' . $thumbnail_id . '" type="saturate" values="0" data-filterid="' . $thumbnail_id . '" /> | |
| </filter> | |
| </defs> | |
| <image filter="url("#filtersPicture-' . $thumbnail_id . '")" x="0" y="0" width="476" height="401" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="' . $thumbnail_url . '" /> | |
| </svg>'; | |
| } else { | |
| $html .= get_the_post_thumbnail( get_the_ID(), $thumb_size ); | |
| } | |
| $html .= '</span>'; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment