cropper: fixed empty logo case

This commit is contained in:
muerwre 2018-11-28 18:13:01 +07:00
parent 34d1b85513
commit 6f21b909c0
6 changed files with 23 additions and 51 deletions

View file

@ -264,10 +264,13 @@ function* getCropData({
canvas.height = height;
const ctx = canvas.getContext('2d');
const image = yield imageFetcher(data);
const logoImage = yield imageFetcher(LOGOS[logo][1]);
ctx.drawImage(image, -x, -y);
ctx.drawImage(logoImage, width - logoImage.width, height - logoImage.height);
if (logo && LOGOS[logo][1]) {
const logoImage = yield imageFetcher(LOGOS[logo][1]);
ctx.drawImage(logoImage, width - logoImage.width, height - logoImage.height);
}
return yield canvas.toDataURL('image/jpeg');
}