Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6656123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:36:17+00:00 2026-05-26T01:36:17+00:00

i just finished my class to make water mark text on image here is

  • 0

i just finished my class to make water mark text on image

here is my problem

1 – user select font file

2 – user select font color

3 – user select watermark position

4 – user select font size

So – my problem is how to calculate the right position depended on font size , family

here is my code i just tried

`

$width = 400; //image width

$height = 300; //image height

                 if($this -> text_posi == 'topleft'){

                     $x1  = ($width  - $width ) + 20;
                     $y1  = ($height - $height) + 40;


                  }elseif($this -> text_posi == 'topright'){

                     $x1  = $width  - 200;
                     $y1  = ($height - $height) + 40;

                  }
                  elseif($this -> text_posi == 'bottomleft'){

                     $x1  = ($width  - $width ) + 20;
                     $y1  = $height - 30;

                  }
                  elseif($this -> text_posi == 'bottomright'){

                     $x1  = $width  - 200;
                     $y1  = $height - 30;

                  }
                  elseif($this -> text_posi == 'topcenter'){

                     $x1  = $width  * .5 - 100;
                     $y1  = ($height  - $height) + 30;

                  }
                  elseif($this -> text_posi == 'bottomcenter'){

                     $x1  = $width  * .5 - 100;
                     $y1  = $height - 30;

                  }
                  elseif($this -> text_posi == 'rightcenter'){

                     $x1  = $width  - 180;
                     $y1  = $height * .5;

                  }
                  elseif($this -> text_posi == 'leftcenter'){

                     $x1  = $width  - $width + 20;
                     $y1  = $height * .5 ;

                  }else{

                     $x1  = ($width  / 2) - 30;
                     $y1  = ($height / 2) - 20 ;
                  }

`

I ThInk It fine if image more than width >= 500 and height >= 500

Can You Help Please

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:36:17+00:00Added an answer on May 26, 2026 at 1:36 am

    Turn away from your monitor, grab a pencil and a piece of paper and draw some pictures:

        watermark in the bottom-right corner
    
                img_width
                |----------- -----------------|<--|
                |                             |   |
                |                             |   |
                |                             |   |
                |                             |   |
                |                             |   | mark Y offset 
    img_height  |                             |   |
                |                             |   |
                |                             |   |
                |                             |   |
                |                mark_width   |   |
                |               |-------------|<--|
                |               |             |
                |   mark_height |             |
                |               |             |
                |-----------------------------|
                ^               ^
                |_______________|
                mark X offset
    

    It should be immediately obvious how to calculate the values for X and Y offsets. To find out how big the watermark is, use http://www.php.net/manual/en/function.imagettfbbox.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just finished writing my own collecion class, and i'd really like to make
I just finished a class on InfoPath where the teacher had a grim view
I just finished creating a Point class and was working on a Line class
I just finished a semester up of C programming for a class I'm in,
Just finished read this post by Greg Young, where he is talking about Microsoft
Just finished reading Crockford's JavaScript: The Good Parts and I have a question concerning
Just finished reading this blog post: http://www.skorks.com/2010/03/an-interview-question-that-prints-out-its-own-source-code-in-ruby/ In it, the author argues the case
I just finished a small project where changes were required to a pre-compiled, but
I just finished a medium sized web site and one thing I noticed about
I just finished a test as part of a job interview, and one question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.