Skip to main content
Inspiring
October 1, 2007
Answered

Help with CFimage

  • October 1, 2007
  • 3 replies
  • 403 views
Hi, I'm following the directions of the livedocs to create a watermark for my images:
The watermark is coming out at the top left corner because the coordinates of the watermark image are set to 0,0. My question is, How do I set it so that the watermark comes out on the bottom center of the image? do i dynamically calculate that or is there a way to do it?

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Images_16.html

Thanks
    This topic has been closed for replies.
    Correct answer Yankeet-3UgX0V
    Thanks Jayesh that worked. what I did was I got the W and H and subtracted for the hight and width of the watermark image, here's the code:

    <cfset alignH =#myImage.height#-120> <cfset alignW =#myImage.width# / 2 - 150>
    <cfset ImagePaste(myImage,myImage2,#alignW#,#alignH#)>

    3 replies

    Yankeet-3UgX0VAuthorCorrect answer
    Inspiring
    October 2, 2007
    Thanks Jayesh that worked. what I did was I got the W and H and subtracted for the hight and width of the watermark image, here's the code:

    <cfset alignH =#myImage.height#-120> <cfset alignW =#myImage.width# / 2 - 150>
    <cfset ImagePaste(myImage,myImage2,#alignW#,#alignH#)>
    Participating Frequently
    October 1, 2007
    Well..I think if you do it ImageRotate way...you have to rotate both the Images. I havent tried it but should work.

    May be also you can use ImageGetwidth/imageGetheight functions to find out the dimensions of both the images and calculate the coordiantes.

    Jayesh Viradiya
    Adobe CF Team
    Inspiring
    October 1, 2007
    Rotate the image 180 degrees then add the watermark to the top upside down, then rotate it 180 degrees again.