• Resolved V.E.L

    (@vezraimanuel)


    Hello!

    I was wondering if it’s possible to change data:image url to base64 url instead of raw <svg>? first, it’ll look clearner as URL, and 2nd SEO scanner might stop complaining about it ??

    from:
    data:image/svg+xml,%3Csvg%20xmlns=%22https://www.w3.org/2000/svg%22%20viewBox=%220%200%20%20%22%3E%3C/svg%3E

    to:
    data:image/svg+xml,base64,(the_encoded_url)

    many thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    you can use the autoptimize_filter_imgopt_lazyload_placeholder filter to change the placeholder whatever way you like VEL ??

    Thread Starter V.E.L

    (@vezraimanuel)

    Ah, good to know, can you show me proper example and on which hook should i call this in functions.php?

    many thanks! @optimizingmatters

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, very simple example;

    
    add_filter('autoptimize_filter_imgopt_lazyload_placeholder','replaceholder');
    function replaceholder($in) {
        $your_own_placeholder = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkqAcAAIUAgUW0RjgAAAAASUVORK5CYII='; // here you can have whatever you want :)
        return $your_own_placeholder';
    }

    hope this helps,
    frank

    Thread Starter V.E.L

    (@vezraimanuel)

    works like a charm! thank you very much! and SEO scanner stops complaining now ??

    this is the code:

    add_filter( 'autoptimize_filter_imgopt_lazyload_placeholder', 'AOReplaceHolder' );
    function AOReplaceHolder($in) {
    	$ao_placeholder = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkqAcAAIUAgUW0RjgAAAAASUVORK5CYII=';
    	return $ao_placeholder;
    };
    • This reply was modified 5 years, 6 months ago by V.E.L.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘base64 svg+xml link for lazyload’ is closed to new replies.