contao/image

Length of either side cannot be 0 or negative, current size is 2x0

ausi opened this issue · 0 comments

ausi commented

See https://community.contao.org/de/showthread.php?81203

If a small image gets resized with a very wide aspect ratio the calculated height might end up being zero. This is invalid as there are no images with 0 height or width.

I think we should force a minimum width/height of 1 in

return new ResizeCoordinates(
new Box(
(int) round($size[0] * $scale),
(int) round($size[1] * $scale)
),
new Point(
(int) round($cropStart[0] * $scale),
(int) round($cropStart[1] * $scale)
),
new Box(
(int) round($cropSize[0] * $scale),
(int) round($cropSize[1] * $scale)
)
);