Title: CSS issues with images
Last modified: October 2, 2018

---

# CSS issues with images

 *  Resolved [tabasco86](https://wordpress.org/support/users/tabasco86/)
 * (@tabasco86)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/css-issues-with-images/)
 * Hi Frank,
 * quick question. I just realized another issue related to the loading of some 
   images. For some reason the CSS isn’t applied to them after applying shortpixel.
   
   See for example the image the the bottom of this page [https://goo.gl/5BxBmk](https://goo.gl/5BxBmk)
 * [https://cdn.shortpixel.ai/client/q_glossy,ret_img,w_56,h_56/https://cormilu.com.br/cormilu-content/uploads/2017/07/artesãs-no-mercado-de-trabalho-cormilu.jpg](https://cdn.shortpixel.ai/client/q_glossy,ret_img,w_56,h_56/https://cormilu.com.br/cormilu-content/uploads/2017/07/artesãs-no-mercado-de-trabalho-cormilu.jpg)
 * thanks and looking forward to hearing from you.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/css-issues-with-images/#post-10742686)
 * looks like a bug, can you open up `wp-content/plugins/autoptimize/classes/autoptimizeExtra.
   php` and on (around) line 366 change
 *     ```
               // extract img tags.
               if ( preg_match_all( '#<img[^>]*src[^>]*>#Usmi', $in, $matches ) ) {
                   foreach ( $matches[0] as $tag ) {
                       $orig_tag = $tag;
   
                       // first do (data-)srcsets.
       ```
   
 * into:
 *     ```
               // extract img tags.
               if ( preg_match_all( '#<img[^>]*src[^>]*>#Usmi', $in, $matches ) ) {
                   foreach ( $matches[0] as $tag ) {
                       $orig_tag = $tag;
                       $imgopt_w = '';
                       $imgopt_h = '';
   
                       // first do (data-)srcsets.
       ```
   
 * and then on (around) line 390 change
 *     ```
                   // proceed with img src.
                   // first get width and height and add to $imgopt_size.
                   if ( preg_match( '#width=("|\')(.*)("|\')#Usmi', $tag, $width ) )  {
       ```
   
 * into
 *     ```
                   // proceed with img src.
                   // first get width and height and add to $imgopt_size.
                   $imgopt_w = '';
                   $imgopt_h = '';
   
                   if ( preg_match( '#width=("|\')(.*)("|\')#Usmi', $tag, $width ) )  {
       ```
   
 * And test if that change fixes things?
 * frank
 *  Thread Starter [tabasco86](https://wordpress.org/support/users/tabasco86/)
 * (@tabasco86)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/css-issues-with-images/#post-10743028)
 * perfect, works!
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/css-issues-with-images/#post-10743125)
 * super, this will be in 2.4.1, out hopefully later this week. thanks for the help
   Amir!
 *  Thread Starter [tabasco86](https://wordpress.org/support/users/tabasco86/)
 * (@tabasco86)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/css-issues-with-images/#post-10743134)
 * Pleasure, thank you for the great work!
 * Have a good week

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘CSS issues with images’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [tabasco86](https://wordpress.org/support/users/tabasco86/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/css-issues-with-images/#post-10743134)
 * Status: resolved