Непоследовательные попытки поставить водяной штамп

Я пытаюсь настроить процедуру для создания водяного штампа.

Код:

// Добавить водный знак

      // Load the stamp and the photo to apply the watermark to
      $stamp = imagecreatefrompng('./uploads/waterstamp.png');

      // 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);

      // Copy the stamp image onto our photo using the margin offsets and the photo 
      // width to calculate positioning of the stamp. 
      imagecopy($rotate, $stamp, imagesx($rotate) - $sx - $marge_right, imagesy($rotate) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));

      // Output and free memory
      imagejpeg($rotate, $filename);
      imagedestroy($source);
      imagedestroy($rotate);

Это работает, но это противоречиво. Водяной штамп внизу справа. На одной из фотографий это выглядит правильно, но на одной это белая ограничительная рамка. У меня мало репутации, чтобы прикрепить снимок экрана, показывающий проблему.

Есть идеи?

0 ответов

Другие вопросы по тегам