Skip to content

Image Doesn't Crop When Of a Smaller Resolution than the params #29

@alihs

Description

@alihs

I am using the new version 1.3 with Get the Image plugin
Here is a snippet of my code

$masonry_grid_loop = new WP_Query($args);
$x = 0;  if($masonry_grid_loop->have_posts()): while ( $masonry_grid_loop->have_posts() ) : $masonry_grid_loop->the_post();

//check if we have images
$params = array( 'width' => 270, 'height' => 270, 'crop' => true );
if ( function_exists( 'get_the_image' )) {
    $image = get_the_image( array( 'image_scan' => true, 'format' => 'array', 'size' => 'full' ) );
    //resize image for full width stuff
}

<div class="item<?php $post_type = get_post_type(); if($post_type == 'case_study') { echo ' item2x'; } ?><?php if( ! empty ( $image ) ) { echo ' w-media'; }?>">
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

        <?php if( ! empty ( $image ) ) { ?>

        <div class="media">
            <a href="<?php the_permalink();?>"><img src="<?php echo bfi_thumb( $image[src], $params );?>" /></a>
        </div>

        <?php } ?>
    </div>
</div>

The image i am trying to upload is attached.
Now when i remove the $params, bfi_thumb works perfectly else it doesn't.
I think it is finding it hard to get the crop stuff for smaller images or am I doing something wrong?

untitled-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions