S
S
S1MY2020-05-27 18:19:01
PHP
S1MY, 2020-05-27 18:19:01

How do I combine an image and save it to the site directory?

Good afternoon, I need to implement combining images and saving to the site directory, but something doesn’t work for me.
src - source image, blue rectangle
srcUpload - image to be overlaid, black cross

$posX = $_POST['podp_x'];
  $posY = $_POST['podp_y'];
  $dest = imagecreatefromjpeg('../'.$_POST['src']);
  $src = imagecreatefrompng('../'.$_POST['srcUpload']);
  echo $_POST['src'];
  echo $_POST['srcUpload'];

  imagealphablending($dest, false);
  imagesavealpha($dest, true);
  imagecopymerge($src, $dest, 0, 0, $posX, $posY, 445, 492, 100);
  
  $name = 'test.png';
  imagefilter($dest, IMG_FILTER_GRAYSCALE);
  imagepng( $dest, "../upload/".$name);

Saves the picture, but does not superimpose another one on it, and at the same time the rectangle becomes black.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question