• Hello Stefan

    I try to use ignored_image_formats for GIF format.
    Unfortunately it does not ignore the GIF files.
    This is my code:

                         $rwp_attributes = array(
                                'sizes' => array( 'image-xs', 'image-sm', 'image-md', 'image-lg', 'image-xlg', 'image-lg@2x' ),
                                'attributes' => array(
                                      'class'           => 'lazyload img-responsive',
                                      'data-sizes'      => 'auto',
                                      'data-parent-fit' => 'cover',
                                      'sizes' => '(min-width: 2000px) 2000px, (min-width: 1540px) 1540px, (min-width: 1000px) 1000px, (min-width: 770px) 770px, (min-width: 321px) 500px, 385px'
                                ),
                                'ignored_image_formats' => array( 'gif' )
    
                            );
                            echo rwp_img( $thumbnail_id, $rwp_attributes );

    Am I missing something?

    Thanks,
    Aldo

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author stefanledin

    (@stefanledin)

    Hi Aldo!
    You’re right, this is a bug. RWP only checks the file format when it converts images from the_content, not when using rwp_img() or any of the other functions.
    One workaround solution before I can take a look at it might be to use wp_get_attachment_metadata() and check the file format before calling rwp_img()

    Thread Starter Aldo

    (@ab_lu)

    Hi Stefan

    Thanks a lot for your feedback.
    It is what I end up doing.

    Looking forward for your fix ??

    Thanks!
    Aldo

    Plugin Author stefanledin

    (@stefanledin)

    Hi Aldo!
    I’m sorry about the lack of progress in this little project! I was planning to work on this during the holidays, but it didn’t turn out like that… ??
    Then I kinda forgot about it, but I’ve been working on this a few days now since I have another update coming up.
    Unfortunately, there’s no simple solution to this. As I said in my first reply, RWP only checks the file format when converting images from the_content. The rwp_img() function never touches that code. I figure that people using those functions most likely knows what they’re doing and can work around this, just like you’ve done.
    The problem is that rwp_img() has to return an element no matter what, so if the file format is ignored, a regular <img /> has to be returned. Nothing complicated about that of course, but I wonder if RWP should handle this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ignored_image_formats ignored’ is closed to new replies.