$destImage = __DIR__ . '/064-493-1101.jpg';
$orig_img = imagecreatefromjpeg($destImage);
// обрезаем
$cropped_img = imagecropauto($orig_img , IMG_CROP_THRESHOLD, null, 16777215);
imagejpeg( $cropped_img, __DIR__ . '/064-493-1101-crop.jpg');
//Get image width / height
$crp_w = ImageSX($cropped_img);
$crp_h = ImageSY($cropped_img);
$crp_ratio = $crp_h / $crp_w;
$ratio = 1.44;
if ( $crp_ratio < $ratio ) {
$new_h = $crp_w * $ratio;
$new_w = $crp_w;
$dst_x = 0;
$dst_y = ($new_h - $crp_h) / 2;
} else {
$new_h = $crp_h;
$new_w = $crp_h / $ratio;
$dst_x = ($new_w - $crp_w) / 2;
$dst_y = 0;
}
// создаем основу
$canvas = imagecreatetruecolor($new_w, $new_h);
$white = imagecolorallocate($canvas, 255, 255, 255);
imagefilledrectangle($canvas, 0, 0, $new_w, $new_h, $white);
// сливаем картинки
imagecopyresampled($canvas, $cropped_img, $dst_x, $dst_y, 0, 0, $crp_w, $crp_h, $crp_w, $crp_h);
imagedestroy($cropped_img);
imagedestroy($orig_img);
imagejpeg( $canvas, __DIR__ . '/064-493-1101-1.jpg');