Tag Archives: center

How to center watermark on images?

This is currently possible with customization:

In script version 1.5.5.:

Open file application\libraries\UploadHandler.php, lines around 383:
search for $watermark_centered = FALSE; and change to TRUE

In script versions <= 1.5.4. :

Open file application\libraries\UploadHandler.php, lines around 375, or search for “$sy = imagesy($stamp);”.

There you should change existing  code with something like:

// Set the margins for the stamp and get the height/width of the stamp image
//$marge_right = 10;
//$marge_bottom = 10;
//$sx = imagesx($stamp);
//$sy = imagesy($stamp);
// center watermark on the photo
$wx = (imagesx($new_img)/2)-(imagesx($stamp)/2);
$wy = (imagesy($new_img)/2)-(imagesy($stamp)/2);
//$success = $success && imagecopy($new_img, $stamp, imagesx($new_img) – $sx – $marge_right, imagesy($new_img) – $sy – $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
$success = $success && imagecopy($new_img, $stamp, $wx, $wy, 0, 0, imagesx($stamp), imagesy($stamp));