yii2-imagine icon indicating copy to clipboard operation
yii2-imagine copied to clipboard

Ignore `OutOfBoundsException` error when watermark grower of source image

Open yii-bot opened this issue 5 years ago • 1 comments

This issue has originally been reported by @NabiKAZ at https://github.com/yiisoft/yii2/issues/16612. Moved here by @samdark.


When use this command:

Image::watermark('image.jpg', 'watermark.jpg')->save('image.jpg');

If dimension of watermark, grower of source image, return this error:

Exception 'Imagine\Exception\OutOfBoundsException' with message 'Cannot paste image of the given size at the specified position, as it moves outside of the current image's box' 

It's fine. But how can ignore this error, so new image will be create but the part of watermark that outside of the image box is hidden and removed.

yii-bot avatar Aug 06 '18 20:08 yii-bot

Related: https://stackoverflow.com/questions/51698580/ignore-outofboundsexception-error-when-watermark-grower-of-source-image

This could be fixed by automatically cropping/resizing watermark in such cases.

rob006 avatar Aug 07 '18 11:08 rob006