I have a problem, I need to know how to correctly and automatically position a photo in any background, for example I want this avatar ( link ) is positioned in the AVATAR field that is 180x180 ( link ).
But I need to make any 180x180 avatar fit into other images, for example: link
I have tried this code but it does not work, I believe it is the coordinates that are incorrect, the bottom is only appearing.
$newNome = md5(time()) . ".jpg";
$mainphoto = imagecreatefromjpeg("foto.jpg");
imagecopymerge($mainphoto, "fundo.jpg", 10, 10, 0, 0, 180, 180, 100);
header('Content-Type: image/jpg');
imagejpeg($mainphoto, $newNome, 50);
imagedestroy($mainphoto);