Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #14819

    Quick question and its not a critical one (I will probably muddle through and figure it out eventually) but…

    How do I add some other image sizes for uploaded images so I can incorporate them into posts more cleanly? Right now after I upload an image it just gives me three real options (other than full-size) for displaying it in the post:

    thumbnail

    medium

    large

    The problem is I just need more categories. I know how to set the sizes of the existing categories in settings > media but I need more than 2 non-thumbnail sizes for images. Just medium and large is not enough, given the different widths of the page and blog content, etc. For example I want to be able to create a “blog-large” category that is exactly the width of my blog text, maybe another that is half this width for right-floated images, etc. And use the existing medium and large for similar uses but on the wider pages.

    After a little research on wordpress.org I discovered that adding the following to my child theme functions.php should do it:

    if ( function_exists( ‘add_image_size’ ) ) {

    add_image_size( ‘blog-full’, 530, 530 );

    }

    I have added this (and I do have a child theme), but I can’t seem to get an extra option for an image size when I upload a new image and try to place it on a post. Still just the old thumbnail, medium, large, etc.

    In the documentation it said that this will not work unless the current theme includes add_theme_support( ‘post-thumbnails’ ); in its functions.php file. Is this what is going on, and why it does not seem to work maybe? If so, is there any danger to me enabling add_theme_support( ‘post-thumbnails’ ), will that conflict with the whole featured image/slider thing in this theme? If I should not enable this (or there is some other issue)…how do I add a few other categories of image sizes?

    #84999

    One quick clarification…all these image sizes would be for non-slider images, ie other images attached or displayed in a post or page with the main post/page content. Figures and Illustrations, often referenced in the text itself. Mostly left/right floating images wrapped by text, of various sizes and aspect ratios (ie some portrait, etc.) That’s why I need more than just 2 image sizes to choose from. Its not really possible to make all the different types of images look good, be large enough, and leave enough room for the text to wrap around them, on both page and posts, with only two sizes to choose from.

    #85000

    You can define custom image sizes in functions.php. Open up the file and add your sizes after following code:

    $avia_config['imgSize']['widget'] 			 	= array('width'=>36,  'height'=>36 );						// small preview pics eg sidebar news
    $avia_config['imgSize']['post-format-image'] = array('width'=>630, 'height'=>999, 'crop'=>false); // big images for post format image and gallery posts
    $avia_config['imgSize']['fullsize'] = array('width'=>930, 'height'=>930, 'crop'=>false); // big images for lightbox and portfolio single entries
    $avia_config['imgSize']['featured'] = array('width'=>930, 'height'=>340); // images for fullsize pages and fullsize slider
    $avia_config['imgSize']['portfolio'] = array('width'=>450, 'height'=>335); // images for portfolio entries (2,3,4 column)

    //dynamic columns
    $avia_config['imgSize']['dynamic_1'] = array('width'=>446, 'height'=>151); // images for 2/4 (aka 1/2) dynamic portfolio columns when using 3 columns
    $avia_config['imgSize']['dynamic_2'] = array('width'=>609, 'height'=>210); // images for 2/3 dynamic portfolio columns
    $avia_config['imgSize']['dynamic_3'] = array('width'=>688, 'height'=>151); // images for 3/4 dynamic portfolio columns

    Eg duplicated following lines:

    $avia_config['imgSize']['fullsize'] 		 	= array('width'=>930, 'height'=>930, 'crop'=>false);		// big images for lightbox and portfolio single entries
    $avia_config['imgSize']['featured'] = array('width'=>930, 'height'=>340); // images for fullsize pages and fullsize slider

    insert them at the bottom and instead of eg “fullsize”, “featured”, etc. use other names for the sizes and adjust the width/height parameters.

    #85001

    Hmm, I just tried that and it didn’t seem to work. I added the following to first the child theme’s function.php file, then later to the parent theme (right after the other imgSize declarations as you suggested):

    $avia_config['imgSize']['blog_full'] = array('width'=>530, 'height'=>530, 'crop'=>false);

    But in neither case could I get the ‘blog_full’ size option to appear when I upload a new image to attach to a post. It may be that I am too much of a WordPress amateur, and I might actually be asking for something that is impossible to do?

    What I want is maybe explained better by the process…

    When I go to my site and select an existing blog post, I click “Edit Post’ in the WP menu. Then above the text editor box I click the image icon next the “Upload/Insert” to “Add Media”. In the popup window I choose to “Add Media Files From Your Computer” and click the “Select Files” button. Then I choose a test .jpg file that I gave a new name to (so it does not duplicate an existing filename). Lets say the file name is ‘Test2.jpg’…I pick this file. WordPress crunches the file, then lets me add a Title, Alt text, Caption, Description, Link URL, and Alignment… Then we get to the part I want to change, where it says “Size” and my only options are Thumbnail, Medium, Large and Full-Size. I have to pick one and after this I can Insert Into Post, or Use as Featured Image, or Delete.

    What I am hoping is possible is that in addition to the list of sizes presently offered me (Thumbnail, Medium, Large, Full-size) I can add a few other sizes here, so for example I get that “blog_full” option to insert a 530px wide image. And I would create a few others. Is this possible, or am I smoking something? Or maybe Ive somehow failed to correctly implement the $aviaconfig declaration above?

    This is not a high priority question by the way, I appreciate all the help you guys have given in this forum there is no rush here at all. I will (hopefully!) muddle through and figure it out on my own, eventually! Maybe I will learn something along the way even.

    #85002

    Maybe…if its not easily possible to add more options to the Size radio buttons when I upload/insert an image, maybe there is a way to alter the inserted code in the post itself, change it to call up my “blog_full” version of an image, instead of the “large” version, for example?

    Or maybe I need some additional plugin to add options to the Size radio buttons, and that’s the best solution? hmm

    #85003

    OK I think I figured it out…I use your code to declare the new image sizes. And then the ‘Simple Image Size’ plugin allows me to see all my image sizes in Settings > Media, and to set which sizes I want as radio button inputs. Lets me regenerate selected image sizes too.

    Another problem solved, TY :)

    Apologies for all my public muddling through, I’m slowly learning things though!

    #85004

    Hi amazeingart,

    No worries. Glad that Peter helped you. :)

    Cheers,

    Ismael

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

The topic ‘How do I add a few new image sizes?’ is closed to new replies.