• Resolved slavipz

    (@slavipz)


    Hi all,
    after the last update of Yoast SEO, I’m getting the following error at the top of my page: Warning: getimagesize() expects parameter 1 to be string, array given in /home/infoioej/public_html/wp-content/themes/newsanchor/functions.php on line 22
    I opened functions.php and like 22 is:

    $size = getimagesize($img_src);

    The whole part is as follows:

    /**
    * Temporary fix
    * OpenGraph add a og:image:width and og:image:height for FB async load of og:image issues
    *
    * https://github.com/Yoast/wordpress-seo/issues/2151
    * https://developers.facebook.com/docs/sharing/webmasters/optimizing#cachingimages
    */
    if(class_exists(‘WPSEO_OpenGraph_Image’)) {
    add_filter(“wpseo_opengraph”, function () {
    global $wpseo_og;

    // will get a array with images
    $opengraph_images = new WPSEO_OpenGraph_Image( $wpseo_og->options );

    foreach ( $opengraph_images->get_images() as $img ) {
    // this block of code will first convert url of image to local path
    // for faster process of image sizes later
    $upload_dir = wp_upload_dir();
    $img_src = str_replace($upload_dir[‘url’], $upload_dir[‘path’], $img);
    $size = getimagesize($img_src);

    // display of this tags with Yoast SEO plugin
    $wpseo_og->og_tag( ‘og:image:width’, $size[0] );
    $wpseo_og->og_tag( ‘og:image:height’, $size[1] );
    }

    }, 32);
    }

    Can you please advise on how to fix this annoying error?

    Thanks in advance

    • This topic was modified 8 years ago by slavipz.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Md Mazedul Islam Khan

    (@mazedulislamkhan)

    We apologize for any inconvenience. Can you please confirm whether the issue persists while using the default 2017 theme?

    In addition, we recommend you please submit this issue directly to our GitHub issue here where the issue appeared while using a different theme. However, the bug report was closed as we were unable to reproduce the issue. So, if you can submit enough information, we’d be happy to investigate this issue further.

    Thread Starter slavipz

    (@slavipz)

    Hi, I can confirm that the issue persists with the default theme. What other information would you require to investigate this further?

    Jerlyn

    (@jerparx)

    @slavipz Can you please confirm if you are on Yoast SEO 7.4.2? If not, can you update to the latest version and check if the issue persists?

    Thread Starter slavipz

    (@slavipz)

    I can confirm that. The version is 7.4.2

    Md Mazedul Islam Khan

    (@mazedulislamkhan)

    We apologize for any inconvenience. We recommend you please report this issue in here with your temporary fix so that our developers can investigate this issue further.

    I’m having similar issue with my wordpress site too:

    “PHP Warning: getimagesize() expects parameter 1 to be string, array given in /home/mwa01/public_html/wp-content/plugins/wp-open-graph/output.class.php on line 308”

    The PHP Warning message pops up on the top of webpages. I’ve updated wp-open-graph recently. Please, help. How were you able to resolve your issue, which looks pretty similar to mine.

    Regards

    Hey,
    did anyone get this resolved? I have the same problem….

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

The topic ‘Warning: getimagesize() expects parameter 1 to be string’ is closed to new replies.