Hello everyone, I recently worked on a watermark program. I used the GD library to add several watermarks to a graph, but the image size is not fixed. This causes the watermark to be suddenly large or small. How can we achieve this function? Hello everyone, I recently worked on a watermark program. I used the GD library to add several watermarks to a graph, but the image size is not fixed. This causes the watermark to be suddenly large or small. How can we achieve this function?
Reply content:
Hello everyone, I recently worked on a watermark program. I used the GD library to add several watermarks to a graph, but the image size is not fixed. This causes the watermark to be suddenly large or small. How can we achieve this function?
Simply put, the solution logic is ready for you to think about.
Step 1: First set an image size that complies with the existing watermark. for example, the image with a watermark of 500*500 or more is very beautiful.
The solution to access is simple. to get the image width and height, you only need to go through the following process as long as it exceeds 500*500:
1: calculate the proportion: such as 100*250, calculate the proportion such as width/500 = 0.2 high/500 = 0.5
2: scale the watermark and paste it again.
You should have understood this clearly.