-
AuthorPosts
-
April 21, 2014 at 10:57 pm #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/zettanet-race-team-welcomes-the-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!
April 24, 2014 at 5:47 am #255301Hi 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!
DavidApril 26, 2014 at 11:58 am #256544Hi 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
April 28, 2014 at 9:18 am #256950Hi!
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,
PeterApril 28, 2014 at 8:59 pm #257309Thanks 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.
April 29, 2014 at 7:34 pm #257821Hey!
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,
DevinApril 6, 2015 at 8:59 pm #424237Hi,
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
April 7, 2015 at 7:53 am #424477Hey!
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,
IsmaelApril 19, 2015 at 3:18 pm #430890Hi. 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
April 21, 2015 at 6:33 am #431770Hey!
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!
IsmaelApril 24, 2015 at 1:34 pm #434056Hi Ismael.
Thanks for your help but it’s still not working :-(April 27, 2015 at 3:02 am #434962Hey!
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/remove-or-update-add-image-size
Don’t forget to regenerate the thumbnails. If you have the Simple Image Sizes plugin installed, please deactivate it first.
Best regards,
IsmaelMay 4, 2015 at 8:52 pm #439296Thanks a lot. Works great!
May 5, 2015 at 10:15 am #439604 -
AuthorPosts
- The topic ‘Image cropping / scaling on thumbnails / featured images’ is closed to new replies.