$error_load = 0;
$upload_dir = 'photos/';
$data = time();
$uploadfile = $upload_dir . $user['id'] . $data . $SALTPHOTO_PLACE . '.jpg';
$uploadfile_s = $upload_dir . $user['id'] . $data . $SALTPHOTO_PLACE . '_small.jpg';
if (move_uploaded_file($_FILES['fupload']['tmp_name'], $uploadfile))
{
if ($_FILES['fupload']['type'] == "image/png")
{
$im = imagecreatefrompng($uploadfile);
$ims = imagecreatefrompng($uploadfile);
}
elseif ($_FILES['fupload']['type'] == "image/gif")
{
$im = imagecreatefromgif($uploadfile);
$ims = imagecreatefromgif($uploadfile);
}
elseif ($_FILES['fupload']['type'] == "image/jpg")
{
$im = imagecreatefromjpeg($uploadfile);
$ims = imagecreatefromjpeg($uploadfile);
}
elseif ($_FILES['fupload']['type'] == "image/jpeg")
{
$im = imagecreatefromjpeg($uploadfile);
$ims = imagecreatefromjpeg($uploadfile);
}
$w_img = imagesx($im);
$h_img = imagesy($im);
if ($w_img <= 950)
{
$neww = $w_img;
$newh = $h_img;
}
else
{
$neww = 950;
$newh = round($h_img * $neww / $w_img,0);
}
$neww_p = 500;
$newh_p = 500;
if ($w_img > $h_img)
{
$neww_s = $h_img;
$newh_s = $h_img;
}
elseif ($w_img < $h_img)
{
$neww_s = $w_img;
$newh_s = $w_img;
}
$im1 = imagecreatetruecolor($neww,$newh);
imagecopyresampled($im1,$im,0,0,0,0,$neww,$newh,imagesx($im),imagesy($im));
imagejpeg($im1,$uploadfile,100);
$point_x = round(imagesx($im)/2) - round($neww_s/2);
$point_y = round(imagesy($im)/2) - round($newh_s/2);
$im2 = imagecreatetruecolor($neww_s,$newh_s);
imagecopyresampled($im2,$im,0,0,$point_x,$point_y,$neww_s,$newh_s,$neww_s,$newh_s);
imagejpeg($im2,$uploadfile_s,100);
$imp = imagecreatetruecolor($neww_p,$newh_p);
imagecopyresampled($imp,$im2,0,0,0,0,$neww_p,$newh_p,imagesx($im2),imagesy($im2));
imagejpeg($imp,$uploadfile_s,100);
imagedestroy($im);
imagedestroy($ims);
imagedestroy($im1);
imagedestroy($im2);
И есть у меня логотип в PNG. Как правильно нацепить его в правый верхний угол картинки при загрузке? Спасибо