Skip to content

Fix negative coordinates bug on Resizer->resizeCrop - #9

Closed
kusmayadi wants to merge 1 commit into
CodeSleeve:masterfrom
kusmayadi:master
Closed

kusmayadi wants to merge 1 commit into
CodeSleeve:masterfrom
kusmayadi:master

Conversation

@kusmayadi

Copy link
Copy Markdown

resizeCorp throw an error if the dimension of an image is wide and it's because the $centerX was negative value.

@sillylogger

Copy link
Copy Markdown
Contributor

I was working with @kusmayadi when this happened.

Original image: 1000x653 px
Problematic style: "440x244#"

values from Stapler/File/Image/Resizer.php#resizeCrop

$optimalWidth: 440
$optimalHeight: 287.32
$centerX: -2.8421709430404E-14
$centerY: 21.66

In retrospect, maybe moving the round call to getOptimalCrop would be better, but some rounding / flooring sounds good here. Cheers!

@tabennett

Copy link
Copy Markdown
Contributor

Yeah, this needs a little flooring in the getOptimalCrop function. This has been done in 160d5c4 and should be working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants