title: Watermark text position bottom right
body: <p>I am using following code to set watermark, but it sets watermark to the center, I want to set it bottom right position.</p>
  
  <pre><code>&lt;?php
  function watermarkImage($fileget, $watermarktext, $saveto) 
      { 
          list($width, $height) = getimagesize($fileget);
          $image_p = imagecreatetruecolor($width, $height);
          $size = getimagesize($fileget);
          $dest_x = $size[0] - $width - 5;  
          $dest_y = $size[1] - $height - 5;
          $image = imagecreatefromjpeg($fileget);
          imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height); 
          $white = imagecolorallocate($image_p, 255, 255, 255);
          $font = FONT_PATH;
          $font_size = 15;
          $bbox = imagettfbbox($font_size, 0, $font, $watermarktext);
          $x = $bbox[0] + (imagesx($image) / 2) - ($bbox[4] / 2) - 25;
          $y = $bbox[1] + (imagesy($image) / 2) - ($bbox[5] / 2) - 5;
          imagettftext($image_p, $font_size, 0, $x, $y, $white, $font, $watermarktext);
          if ($saveto&lt;&gt;'') {
              imagejpeg ($image_p, $saveto, 100); 
          } else {
              header('Content-Type: image/jpeg');
              imagejpeg($image_p, null, 100);
          };
          imagedestroy($image); 
          imagedestroy($image_p); 
      }
  ?&gt;
  </code></pre>
  
  <p>I am referring this answer: <a href="https://stackoverflow.com/questions/22674918/center-watermark-text-on-image-when-unknown-size-of-text">answer-1</a></p>
  
  <p>How to <strong>set the position to bottom right</strong> direction?</p>