Hello, all,
I know. The question in the title can be a bit confounding. It is to me, too, and I wrote it!
I'm trying to dynamically add watermarking to images using imageDrawText(). A company name centered in the image.
Now, if the only word(s) used are, say, a company name, then it's not a stretch to just play around with arguments until the text is centered on the image.
But, what do you do if the text could change from image to image?? Suppose, for this hypothetical scenario, that after the company name the photographer's first and last name will be below the company name, and said names are of various lengths. And to make things even MORE interesting, the images used are different sizes and a mix of landscape and portrait oriented images.
I'm trying to create code that will dynamically center the text on every image in a directory. Understandably, I'd have to get the width and height of the image, divide by two to get dead-center, then offset by the width/height of the text. So, if I'm creating different text for each image which are all different sizes, how does one calculate the offset?
I'm stepping out for a smoke. I'll post some pseudo-code when I get back.
V/r,
^_^