• Resolved davesmith_au

    (@davesmith_au)


    I have installed smush but not yet smushed any existing images. I am concerned about my header image.

    If I set my image size to say, 550×550, then smush them all, what happens to a header image which is 1150×120?

Viewing 4 replies - 1 through 4 (of 4 total)
  • @davesmith_au, You can exclude a particular image id by using the filter, wp_smush_image
    The filter is available from WP Smush version 2.5.2 onwards only, so make sure you’re on the latest version.

    Here is an example to use it:

    function skip_smush( $smush, $attachment ) {
      //Attachment ids that needs to be skipped
    	if( 116 == $attachment || in_array( $attachment, array(117, 118, 119, 132, 137, 170 ) )  ) {
    		return false;
    	}
    	return $smush;
    }
    add_filter( 'wp_smush_image', 'skip_smush', '', 2 );

    Take a backup of the image, if you’re in doubt.

    Cheers

    Thread Starter davesmith_au

    (@davesmith_au)

    Thanks @umeshsingla, but I’m not sure WHERE you’re suggesting I use this code 🙂 Does it go in my (child) theme’s functions file, or the smuch functions file, or where?

    ALSO I am unfamiliar with “attachment ids” – Is this the image’s file name, like “banner6.png” or is it something else? I cannot find image attachment id numbers anywhere on the image attachment page.

    • This reply was modified 9 years, 6 months ago by davesmith_au.
    • This reply was modified 9 years, 6 months ago by davesmith_au.

    @davesmith_au, You’d need to add the code in your (child) theme’s functions.

    About the attachment id, if you click over a image in gird/list view, you can see the attachment id in URL. Attaching a screenshot to help you out with that.

    1. In URL – https://monosnap.com/file/5VQhiGJKXskdnFtGeDgfGjzMxQK4aF
    2. On hover ( List Mode ) – https://monosnap.com/file/zgTP0U2ffUkPZWPaZQZECg2UjZqmn0

    Cheers

    Thread Starter davesmith_au

    (@davesmith_au)

    Thanks for both answers @umeshsingla you are a good help. On the second one, I feel like a dill! I looked everywhere EXCEPT the obvious place, the browser address bar!

    Ah well, the only bad question is the one you don’t ask I guess. Maybe it’ll help someone else out there too!

    Cheers, and thanks again.

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

The topic ‘Header re-size question…’ is closed to new replies.