Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #254040

    Hi there, first off I really love the theme. Nice work guys!

    Now for my Q. Is there any way to configure how images inserted into posts / thumbnails generated for blog posts are cropped / scaled?

    For example the featured image of this post has the top and bottom cropped, but it should display the guys faces. How do i go about correcting this?

    http://www.zettanetracing.com/ (Purchase code hidden if logged out) -ferret-into-the-business/

    Some images are fine but others are cutting off key parts of the image. Another example is the thumbnails on this page, some look perfect while others are cutting off key parts of the image.

    http://www.zettanetracing.com/#after_full_slider_0

    Is there any way to do this without manually cropping / scaling the image before uploading?

    Thanks in advance!

    #255301

    Hi brendymullan!

    There is a way to customize the size of the images so to give you an example, on the functions.php file roughly line 93 you will find this code,

    
    // small image for blogs
    $avia_config['imgSize']['featured'] 		 	= array('width'=>1500, 'height'=>430 );						// images for fullsize pages and fullsize slider
    $avia_config['imgSize']['featured_large'] 		= array('width'=>1500, 'height'=>630 );	
    

    You can customize the width / height of your images here and in this case these is going to be the default for feature images.

    In this way you can avoid having to do this by hand.

    Cheers!
    David

    #256544

    Hi David, not sure this applies to my question? It’s not the size of the image i’m looking to change. It’s how the image is scaled / cropped. If you check the examples i posted above you’ll see what I mean.

    Thanks

    #256950

    Hi!

    Yes, afaik it’s possible to change the crop position since WP3.9. In functions.php search for:

    
    $avia_config['imgSize']['entry_with_sidebar'] 	= array('width'=>710, 'height'=>270);		                 // big images for blog and page entries
    $avia_config['imgSize']['entry_without_sidebar']= array('width'=>1030, 'height'=>360 );						// images for fullsize pages and fullsize slider
    

    and replace these lines with

    
    $avia_config['imgSize']['entry_with_sidebar'] 	= array('width'=>710, 'height'=>270, array(top, center));		                 // big images for blog and page entries
    $avia_config['imgSize']['entry_without_sidebar']= array('width'=>1030, 'height'=>360, array(top, center));						// images for fullsize pages and fullsize slider
    

    You can replace ‘top’ with ‘center’, or ‘bottom’ (y position) and ‘center’ with ‘left’ or ‘right’ (x position). After the code change you must regenerate the thumbnails with: http://wordpress.org/plugins/regenerate-thumbnails/

    Regards,
    Peter

    #257309

    Thanks Peter, is there a way to not have the images cropped? The main issue is that for some images the key part of the image could be in the middle, top or bottom of the image. So would be nice to show a scaled version as opposed to cropping.

    Is that possible?

    Also, can those lines above be added to the child theme functions.php rather than the core WordPress functions file?

    Thanks in advance.

    #257821

    Hey!

    You can try using this plugin which reads and allows you to edit the sizes throughout the theme and WordPress at once: http://wordpress.org/plugins/simple-image-sizes/

    Best regards,
    Devin

    #424237

    Hi,
    I want to crop the images a diffent way as well.
    But I’m using a childtheme, so how do I change the functions correctly?

    Thanks, lars

    #424477

    Hey!

    You can use this:

    add_action('init', 'ava_my_image_size', 1);
    function ava_my_image_size()
    { 
    global $avia_config;
    avia_config['imgSize']['entry_with_sidebar'] 	= array('width'=>710, 'height'=>270, array(top, center));		                 // big images for blog and page entries
    $avia_config['imgSize']['entry_without_sidebar']= array('width'=>1030, 'height'=>360, array(top, center));						// images for fullsize pages and fullsize slider
    }

    Regenerate or upload the images again.

    Regards,
    Ismael

    #430890

    Hi. I tried to use this in my child-theme function.php for the small portfolio images:

    add_action('init', 'ava_my_image_size', 1);
    function ava_my_image_size()
    { 
    global $avia_config;
    $avia_config['imgSize']['portfolio_small'] 		= array('width'=>260, 'height'=>185, array(top, center));						// images for portfolio 4 columns
    }
    

    and after that I used http://wordpress.org/plugins/regenerate-thumbnails/ for the wanted images, but it stayed the same?!
    Any ideas?

    thanks

    #431770

    Hey!

    My bad. Please replace the code with this:

    add_action('init', 'ava_my_image_size', 1);
    function ava_my_image_size()
    { 
    global $avia_config;
    $avia_config['imgSize']['portfolio_small'] 		= array('width'=>260, 'height'=>185, array('top', 'center'));
    }

    Cheers!
    Ismael

    #434056

    Hi Ismael.
    Thanks for your help but it’s still not working :-(

    #434962

    Hey!

    Hmm.. Yeah. Looks like it’s not working in a child theme but editing the code directly in the functions.php works fine. This should do the trick in the child theme:

    function ava_image_sizes() { 
    add_image_size('portfolio_small', 261, 186, array('center', 'top'));
    }
    add_action( 'after_setup_theme', 'ava_image_sizes', 11 );

    Based on: http://wordpress.stackexchange.com/questions/74934/ (Purchase code hidden if logged out) -size

    Don’t forget to regenerate the thumbnails. If you have the Simple Image Sizes plugin installed, please deactivate it first.

    Best regards,
    Ismael

    #439296

    Thanks a lot. Works great!

    #439604

    Hey!

    Great, glad we could help :)

    Best regards,
    Rikard

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

The topic ‘Image cropping / scaling on thumbnails / featured images’ is closed to new replies.