• Resolved topsyde

    (@topsyde)


    Just a heads up guys — you need to comment out this error log in your /inc/lazyload_replacer.php file, we’re getting log spammed.

    public function get_svg_for( $width, $height, $url = null ) {
    
        if ( $url !== null && ! is_numeric( $width ) ) {
            $url   = strtok( $url, '?' );
            $key   = crc32( $url );
            $sizes = wp_cache_get( $key, 'optml_sources' );
            if ( $sizes === false ) {
                $filepath = substr( $url, strpos( $url, $this->upload_resource['content_folder'] ) + $this->upload_resource['content_folder_length'] );
                $filepath = WP_CONTENT_DIR . $filepath;
                if ( is_file( $filepath ) ) {
                    $sizes = getimagesize( $filepath );
                    error_log( 'get_svg_for: ' . var_export( $sizes, true ) . ' ' . $url );
                    wp_cache_add( $key, [ $sizes[0], $sizes[1] ], 'optml_sources', DAY_IN_SECONDS );
                }
            }
            list( $width, $height ) = $sizes;
        }
        // If the width is not found the url might be an offloaded attachment so we can get the width and height from the metadata.
        if ( ! is_numeric( $width ) && ! empty( $url ) ) {
            $attachment_id = $this->attachment_url_to_post_id( $url );
            $meta = wp_get_attachment_metadata( $attachment_id );
            $width = $meta['width'] ?? false;
            $height = $meta['height'] ?? false;
        }
    
        $width  = ! is_numeric( $width ) ? '100%' : $width;
        $height = ! is_numeric( $height ) ? '100%' : $height;
        $fill = $this->settings->get( 'placeholder_color' );
    
        if ( empty( $fill ) ) {
            $fill = 'transparent';
        }
    
        return str_replace(
            [ '#width#', '#height#', '#fill#' ],
            [
                $width,
                $height,
                urlencode( $fill ),
            ],
            self::SVG_PLACEHOLDER
        );
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Buddy

    (@friendswp)

    Hi there,

    You are right, we will roll out a fix tomorrow.

    Thank you!

    Plugin Support Buddy

    (@friendswp)

    Hi there,

    The most recent version, 4.1.2 is fixing the issue.

    Thank you for understanding.

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

The topic ‘Error log spam’ is closed to new replies.