You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.
My users will be uploading different size images. Is there a way to make sure either we resize the uploaded image OR make the watermark cover 100% width?
The text was updated successfully, but these errors were encountered:
Hi, I am not make the watermark cover 100% width, but I got resize the watermark. Here is what I do:
1. Using image(draw) to customize my watermark process.
I found documentation got this method, then I use it to customize my process:
// place a watermark in the upper left hand corner of an imagewatermark(['/img/coffee.jpg','/img/logo.png']).image(function(coffee,logo){varcontext=coffee.getContext('2d');context.save();context.globalAlpha=alpha;context.drawImage(logo,10,10);context.restore();returntarget;});
2. Using drawImage() to resize.
I found drawImage() on MDN, which parameters could control the size of the image you draw, that size is based on the canvas size. For example, your canvas's width is 700, and if you want your watermark cover 100% width, you should add 700 to your forth parameters in drawImage().
My users will be uploading different size images. Is there a way to make sure either we resize the uploaded image OR make the watermark cover 100% width?
The text was updated successfully, but these errors were encountered: