WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] image sizes for all blogs in multisite (7 posts)

  1. raskull
    Member
    Posted 3 years ago #

    In Settings > Media I can set the image sizes for thumbnail, medium, and large, but only on a site-by-site basis. Is there a way to set the sizes for all blogs? Furthermore, is there a way to do it at the theme level, in the functions file? I don't want to hardwire in the sizes at the blog/user level, as a different theme might want different image sizes.

  2. raskull
    Member
    Posted 3 years ago #

    ok, I found where the defaults are being set by wordpress: /wp-admin/includes/schema.php

    Now I need to figure out how to filter it in my theme's functions file...

  3. raskull
    Member
    Posted 3 years ago #

    Well, that gets me somewhere, but I also want to change the medium size from default 300 to 222. I found the ability to do this:
    update_option( 'medium_size_w', 222 )
    but that seems to be too little too late used like that in my functions file...

  4. Michael Bishop

    Posted 3 years ago #

    The New Blog Defaults plugin will allow you to set default sizes for all new blogs created, among many other options.

  5. James Collins
    Member
    Posted 3 years ago #

    If you look at the source of the get_option() function (http://core.trac.wordpress.org/browser/trunk/wp-includes/functions.php#L274), you'll see that you can use the pre_option_* filter to override/customise the value for an option.

    For example, the following code will cause get_option('medium_size_w') to always return 222:

    add_filter( 'pre_option_medium_size_w', 'my_override_medium_size_w' );
    function my_override_medium_size_w($size) {
       return 222;
    }

    You can use similar code to override the other image sizes too.

    If you put this in your theme's functions.php file, you'll be able to force specific image sizes for all sites that use that theme.

  6. raskull
    Member
    Posted 3 years ago #

    Double jackpot! I'm already using New Blog Defaults -- didn't think to look there. And with with the second solution, I ought to be able to take over the world. Thanks all!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.