Hi, The attached script is from a plugin for Joomla, that overlays a watermark on an Image, Thumbnail & Avatar. It works, BUT it aligns the watermark (based on coordinates in input in the Joomla backend), from the TOP LEFT of the source image. I need it to align the watermark from the BOTTOM LEFT of the source image. I am not much of a php expert, and maybe this is a simple change. I have tried a few things and wind up breaking the code. I have also asked the developer to make the changes for a fee with no luvk. I would love some help with this and AM willing to HIRE someone to do it if I need to. I think, from my limited understanding, that changing this will affect the change on all of the images, the Image, Thumbnail & Avatar. That is fine. I think this is the relevant line of code from line 355: // Combine background image and watermark into a single output image imagecopy($background, $watermark, $positionX, $positionY, 0, 0, $watermarkWidth, $watermarkHeight); PHP: But I have also attached the php script. View attachment jswatermark.php Please Help, this is driving me nuts!
The bottom left is the top left plus the height. Align it that way. (You have to do the math, PHP can't.)
Thanks Rukbat, the problem is that photos are different sizes. Some are oriented vertically and some are horizontal. So it would be great to base the placement of the watermark off the bottom left or bottom right so that it is consistently in the same place, relative to the bottom of the image.
Then you'll have to calculate the top-left-relative positioning for each one yourself (in code, dynamically, of course). The browser doesn't calculate from the bottom, it calculates from the top, so you can't give it bottom-relative numbers. Offset the top by the height relative to the height of the image (positive if the watermark is smaller than the image, negative if it's larger). And be aware of the box model problem if you're going to have borders or padding.
Well, this is my attempt...although it is not doing much. Again, this is totally new to me, I don't know a lot of php. Am I close, or totally off base? imagecopy($background, $watermark, $positionX, $positionY, 0, imagesy($displayHeight), $watermarkWidth, $watermarkHeight); Code (markup): imagecopy($background, $watermark, $positionX, $positionY, 0, $positionY - imagesy($displayHeight), $watermarkWidth, $watermarkHeight); Code (markup): imagecopy($background, $watermark, $positionX, $positionY, 0, $positionY - $srcHeight, $watermarkWidth, $watermarkHeight); Code (markup):