• Resolved sue_b

    (@sue_b)


    Hi,

    I’m using the Jetpack “top posts” widget.

    In the last couple days, it has stopped cropping images to thumbnails, and is instead re-sizing.

    Any fix?

    Thanks!

    (url: https://www.bayview-news.com)

    ….just realized this should be in jetpack forum, sorry.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    I believe you’re running into this issue:
    https://github.com/Automattic/jetpack/pull/6140

    Until the problem is fixed in the next version of Jetpack, could you try to add the following to your theme’s functions.php file, or in a functionality plugin? That should solve the issue.

    /**
     * Resize all Top Posts Images to 40x40px
     *
     * @param array $image_options Array of Image options.
     */
    function jeherve_top_posts_images_size( $image_options ) {
    	$image_options['avatar_size'] = 40;
    
    	return $image_options;
    }

    Sorry for the trouble!

    Thread Starter sue_b

    (@sue_b)

    Thank you!!! ??

    I’m not that comfortable with editing PHP, so wish me luck! ??

    Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    The functionality plugin I linked to above should make it a bit easier:

    1. install and activate the plugin.
    2. go to the new menu it created.
    3. Create a new snippet.
    4. Paste the code I posted above.
    5. Save and activate the snippet.

    That should be it!

    Thread Starter sue_b

    (@sue_b)

    i followed your directions… didn’t work? :-/

    https://www.bayview-news.com/wp-content/uploads/2017/01/code-snippet.jpg

    Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Oh, I’m sorry, I forgot to paste one line of my code snippet! Try with this instead:

    
    /**
     * Resize all Top Posts Images to 40x40px
     *
     * @param array $image_options Array of Image options.
     */
    function jeherve_top_posts_images_size( $image_options ) {
    	$image_options['avatar_size'] = 40;
    
    	return $image_options;
    }
    add_filter( 'jetpack_top_posts_widget_image_options', 'jeherve_top_posts_images_size' );
    
    Thread Starter sue_b

    (@sue_b)

    That worked! THANK YOU!!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘“Top Posts” Widget (Jetpack), image cropping’ is closed to new replies.