Skip to content

analyse() returns NULL #2

@seltix5

Description

@seltix5

hello,
when running this code with image of 483x600px the analyse() returns ['topCrop' => NULL] :

        $smartcrop = new xymak\image\smartcrop($file_img_resource, ['width' => 300, 'height' => 225]);
        //Analyse the image and get the optimal crop scheme
        $res = $smartcrop->analyse();

After some tests I could find out the analyse() returns this because generateCrops() returns null.
And generateCrops() returns null because $cropWidth = 301 instead of 300 and because of that it never enters the 3rd FOR.
And $cropWidth is that value because in canvasImageScale() the $this->options ['cropWidth'] is set to 301px.

What should be the best solution here?
Thanks.

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