Math problem, not a PHP problem.
$x = 300;
$y = 50;
$watermarkx = 30; /width of the watermark
$watermarky = 30; /height of the watermark
the coordinates to put your watermark centered at the bottom would be
(($x / 2) - ($watermarkx / 2),($y - $watermarky))
or 135,20