• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to add more image sizes

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to add more image sizes

This topic is: resolved

Tagged: image size

  • This topic has 4 replies, 2 voices, and was last updated 8 years, 2 months ago by Martina.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • March 4, 2015 at 4:30 am #143153
    Martina
    Member

    Does anybody know how to add more image sizes? I use the Eleven40.

    Image sizes are mentioned here with a code snippet:
    http://gregrickaby.com/genesis-code-snippets/

    But there is also mentioned I have to add the WP-Cycle-Plugin to get it work but the plugin is outdated.

    http://www.martinaleukert.de
    March 4, 2015 at 5:37 am #143157
    Pixel Frau
    Member

    Hi Martina. You can use this code in your functions.php file to add image sizes:

    //* Add new featured image sizes
    add_image_size( 'home-bottom', 150, 100, TRUE );

    home-bottom is the name of the image size. You can call it whatever you want. 150 is the image width, and 100 is the image height.

    You might need to use the Regenerate Thumbnails plugin after adding an image size. This will create thumbnails for your new image size for the existing images in your media library.

    March 5, 2015 at 2:08 am #143251
    Martina
    Member

    Hi Pixel Frau,

    unfortunately the code does not work. Nothing shows up in the media library to chose this sample size (I have uploaded a new large picture to try this).

    I have found a code, but this works just for this indicated size but I don't know how to add a few more sizes:

    if ( function_exists( 'add_image_size' ) ) {
    add_image_size( 'new-size', 350, 250, true ); //(cropped)
    }
    add_filter('image_size_names_choose', 'my_image_sizes');
    function my_image_sizes($sizes) {
    $addsizes = array(
    "new-size" => __( "Rechteck")
    );
    $newsizes = array_merge($sizes, $addsizes);
    return $newsizes;
    }

    March 5, 2015 at 2:13 am #143252
    Pixel Frau
    Member

    Ah, ok. The code does indeed work (those image sizes will be available in Genesis Featured Post widgets, etc. But you're right, it does not add the image size to the media library. That requires an additional step.

    You can add something like this to functions.php:

    //* Add new image sizes to post or page editor
    add_filter( 'image_size_names_choose', 'mytheme_image_sizes' );
    function mytheme_image_sizes( $sizes ) {
    
        $mythemesizes = array(
            'featured' 		=> __( 'Home Size' ), 
            'portfolio' 	=> __( 'Portfolio Size' ), 
        );
        $sizes = array_merge( $sizes, $mythemesizes );
    
        return $sizes;
    }

    Full explanation here.

    March 5, 2015 at 4:39 am #143277
    Martina
    Member

    Yup, that works like a charm. Thank you, I appreciate!

    Thanks for posting the link, that makes everything clear.

    Heres my full code (for 2 sizes I have added) just in case anybody is looking for it and has difficulties to put everything together - this is supposed to be in the functions.php:

    //* Add new image sizes to post or page editor
    add_filter( 'image_size_names_choose', 'mytheme_image_sizes' );
    function mytheme_image_sizes( $sizes ) {

    $mythemesizes = array(
    'featured' => __( 'Full Width' ),
    'portfolio' => __( 'Tinas Mittel' ),
    );
    $sizes = array_merge( $sizes, $mythemesizes );

    return $sizes;
    }

    //* Add new featured image sizes
    add_image_size( 'featured', 800, 400, TRUE );
    add_image_size( 'portfolio', 200, 300, TRUE );

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘How to add more image sizes’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble