I would like to crop the image using imagecreatetruecolor, and it always visits it, leaving black spaces, or the scale is too large. I want the image to be exactly 191px wide and 90px high, so I also need to resize the image as well as the crop, because this ratio needs to be preserved. Well, there are a few project examples:

The size of the script (simplified) is as follows:
$src_img=imagecreatefromjpeg($photoTemp); list($width,$height)=getimagesize($photoTemp); $dst_img=imagecreatetruecolor(191, 90); imagecopyresampled($dst_img, $src_img, 0, 0, $newImage['crop']['x'], $newImage['crop']['y'], $newImage['crop']['width'], $newImage['crop']['height'], $width, $height);
The array $ newImage ['crop'] includes:
['x'] => $_POST['inp-x'] ['y'] => $_POST['inp-x'] ['width'] => $_POST['inp-width'] ['height'] => $_POST['inp-height']
But I get:

Does anyone see what I'm doing wrong?
Thanks, Mike.
source share