Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
  • #16751

    Hi everybody,

    I customized the flashlight theme and I’m very happy with it but :

    I set my blog with the option “Blog Overview Image layout” defined on “Display Image Above Entry” and everything is fine.

    But it displays me the whole image and for the blog list this is not very effective… Mainly when image got a very big height…

    Is there a way to force the blog list to show a height cropped version of the featured image?

    Thanks a lot for your answers!



    You can always edit functions.php and find this code

    $avia_config['imgSize']['blog'] = array('width'=>430, 'height'=>9999, 'crop'=>false); // image for blog posts

    This controls the images use for blog page. You can do something like

    $avia_config['imgSize']['blog'] = array('width'=>430, 'height'=>400 ); // image for blog posts

    This will resize all of the blog images to 430x400px.




    Hi Ismael,

    And thanks for your answer, but I already know this trick and previously modified this function.

    In fact I want the image to be cropped in the blog item list, but not in the blog post.

    It seems that there is no difference in the “function.php” between image displayed in the blog item list and the gallery “Image list attached to the entry”… it’s the same.

    Because I like this kind of gallery and created one for each of my publications and posts.

    If you can find a solution, it would be great!


    Hi Ramen_cup,

    As of the moment, I can’t think of any solutions. Let me tag the rest of the support.





    In functions.php the specific dimensions for various locations within the theme are outlined. When you upload your image, based on those settings, multiple versions of the image are automatically created, each with the dimensions you specify in functions.php. Please take a look below:

    $avia_config['imgSize']['widget'] 		= array('width'=>48,  'height'=>48 );						// small preview pics eg sidebar news, fullscreen slideshow thumbnails
    $avia_config['imgSize']['related'] = array('width'=>130, 'height'=>130); // small images for related items
    $avia_config['imgSize']['masonry'] = array('width'=>240, 'height'=>9999, 'crop'=>false); // masonry images
    $avia_config['imgSize']['portfolio'] = array('width'=>200, 'height'=>140); // medium preview pic portfolio
    $avia_config['imgSize']['blog'] = array('width'=>430, 'height'=>9999, 'crop'=>false); // image for blog posts
    $avia_config['imgSize']['fullsize'] = array('width'=>1500, 'height'=>1500, 'crop'=>false); // big images for fuöösize slider

    The fourth word of each line shows the location and later come the dimensions of the image. Whenever you see 9999, means that the image is going to keep its aspect ratio. The fourth word – Widget, Related images, masonry, individual portfolio, blog and full size are the various images. You said you wanted blog changed? Right now width is set at 430px while height is 9999. also crop is set to false, so it will always be proportional. So, you can either :

    a) change height from 9999 to whatever you want and set crop to true.

    b) Go to the backend > settings > media and change the Maximum Width and Maximum Height of the Medium Image (if you want to maintain the aspect ratio of the image.

    Since I can’t see your site I hope I understood your requirements,.




    Thanks a lot Nick & Ismael for your attention,

    I already know how to tweak the function.php, so here is the url of my problem:

    On this page I want each featured image to be crop in height.

    But then when you enter a blog post (for example “C** de Mime!”), I want the same image not to be cropped.

    I hope you will find a solution.




    in includes/loop-index.php replace:

    if($layout == "full")
    $class = "preview_image_full";
    $size = "blog";


    if($layout == "full")
    $class = "preview_image_full";
    $size = is_single() ? "blog" : "blogcropped";

    and add a new thumbnail size to functions.php like:

    $avia_config['imgSize']['blog'] 		= array('width'=>430, 'height'=>9999, 'crop'=>false);		// image for blog posts
    $avia_config['imgSize']['blogcropped'] = array('width'=>430, 'height'=>150, 'crop'=>true); // image for cropped blog post images

    You can change the dimension(s) of the blogcropped size.


    Hello Dude,

    Ok I replaced everything, but there is no change for the moment…

    But you get the point, it’s all about making a new thumbnail size.

    Now we have to find a way to activate it.



    Did you regenerate the thumbnails with: ?




    Yes of course!

    All the thumbnails were regenerated with this plug-in.

    But with no change…



    Would you paste in loop-index.php the code below , a slightly modified version, (lines 44-48) or so and make sure Dude’s update of functions.php in the post above is included:

    if($layout == "full")
    $class = "preview_image ";
    $size = "blogcropped";

    When you test it , please look at the source code of the homepage, and find the class being used on the anchor *href* that wraps the image, did the class change from preview_image_full to preview_image?

    Where are you setting a hard crop at 150 height 750 width? When you upload the image it lists multiple sizes, do you see an option there for 750×150 and its labeled as blog? So it can be only in one of two places. Play around and move 150 somewhere to 200, regenerate the thumbs and see what changed. That’s the only way to get to the bottom of this.




    Hi Nick,

    I’ve done your coding modifications right now ; you can have a look here :

    But it also crop the image in the blog post.

    I think we should create another layout to achieve this ?

    About Dude’s modifications, it seems that I uploaded the wrong “functions.php”… that’s why I couldn’t see any changes.

    Sorry for that. And the result is the same as yours : ok in the blog list, but in the blog post, the images are also cropped.




    That’s good. Please use Dude’s version, as mine was for testing only. Before the images were 750×150 on individual posts and on the blog, now i see 750×300 on the blog and 750×150 on individual page. Yeh, make sure to use Dude’s code.




    You’re right,

    Everything is fine know!

    Thank you very much Ismael, Nick & Dude for your answers!



    Hey John,

    Glad its all working for you now :)




    Hi everybody!

    I finally came back here, because I found something else about this code modification…

    After the changes everything works fine until I wanted to add a page with an “Image slideshow at the top of the entry”.

    If I upload images with a width of 750px, they will be cropped to 150px.

    See it here :

    Else if I upload images with a width of 751px for example, it’s fine but they appears much more blurry.

    See it here :

    I hope you’ll find a solution…

    And thanks in advance for your answer!



    Nice actors collage on the page, but does that 4.17 meg image load at all in iphone? Out of curiosity I wanted to see how much further I can optimize it without loss of quality, and it will go down to 1.14 megs easily.

    You should install , which will centralize all the theme’s sizes on the Settings > Media page as well as provide a resize option right on that page as well, making life easier.

    What size/aspect ratio are you looking for? proportional with 750 width and as high as the proportion allows? You should find the constraint max-width of 750 and width of 750 with height of 9999 and no crop. Please try out the plugin and I think it will make a lot more sense then poking around functions.php




    Thanks a lot Nick for your answer.

    I’ve installed this plug and I am able to manage image size easily.

    Everything is fine now.

    Have a nice week!

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

The topic ‘height cropped version of the featured image’ is closed to new replies.