Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to resize the watermark or the inserted image? #1103

Closed
adi-rebellion opened this issue Jul 23, 2021 · 1 comment
Closed

How to resize the watermark or the inserted image? #1103

adi-rebellion opened this issue Jul 23, 2021 · 1 comment

Comments

@adi-rebellion
Copy link

How can we resize the inserted image

@jcogs-design
Copy link
Contributor

jcogs-design commented Dec 1, 2021

One way to do this is to:

  • create a new image with a transparent background with the dimensions of the original watermark image
  • add your watermark to this image (see note below)
  • adjust the size and opacity of this combined watermark image as you want
  • insert the image over the base image

You can do all of this using two separate Intervention images, but I find it is hard to adjust opacity using the Intervention->opacity() method, which appears to be quite inefficient; it seems to be easier to vary the opacity of the watermark by initially creating the watermark image as an empty transparent GdImage object and then combine this with the watermark source image using something like imagecopymerge_alpha (see in user added comments), then adding the watermark to the base image using the Intervention->insert() method.

HTH

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

No branches or pull requests

3 participants