Ошибка в обрезании фото PHP
С новыми стандартами переделываю обрезание фото, но оно выдаёт ошибки. Пути проверял несколько раз, и относительные ставил и абсолютные, и напрямую путь подкидывал, но без успешно( В базу записывается.
// ОБРЕЗАТЬ ФОТО И СОХРАНИТЬ
if(($task=="new_crop") AND ($insert) AND ($id==$sender) AND ($cmd=="6")){
$img = $users->get_post_data('big');
$room_id = intval($users->get_post_data('room_id'));
$album = intval($users->get_post_data('album'));
$file_width = $users->get_post_data('w');
$file_height = $users->get_post_data('h');
$x1 = $users->get_post_data('x1');
$y1 = $users->get_post_data('y1');
$cn_foto = md5(date('Y-M-D-h-m-s'));
$big = "users_alb/$sender/big/".$cn_foto.".jpg";
$thumb = "users_alb/$sender/thumb/".$cn_foto.".jpg";
// START WEBP ФОТО
$webp_big = "users_alb/$sender/webp_big/".$cn_foto.".webp";
$webp_thumb = "users_alb/$sender/webp_thumb/".$cn_foto.".webp";
// END WEBP ФОТО
if($file_width > $file_height){
$out_height = ($file_width / $foto_big_size);
$width = $foto_big_size;
$height = ($file_height / $out_height);
}else{
$out_width = ($file_height / $foto_big_size);
$height = $foto_big_size;
$width = ($file_width / $out_width);
}
$w = $width;
$h = $height;
//print "$x1, $y1, $width, $height, $file_width, $file_height";
$file = imagecreatetruecolor($w, $h);
$new = imagecreatefromjpeg($img);//313 строчка
imagecopyresampled($file, $new, 0, 0, $x1, $y1, $width, $height, $file_width, $file_height);
imagejpeg($file, $big, 100);
ImageDestroy($new);
ImageDestroy($file);
$file = imagecreatetruecolor($w, $h);
$new = imagecreatefromjpeg($img);
imagecopyresampled($file, $new, 0, 0, $x1, $y1, $width, $height, $file_width, $file_height);
imagejpeg($file, $thumb, 100);
ImageDestroy($new);
ImageDestroy($file);
$file = imagecreatetruecolor($w, $h);
$new = imagecreatefromjpeg($img);
imagecopyresampled($file, $new, 0, 0, $x1, $y1, $width, $height, $file_width, $file_height);
imagewebp($file, $webp_big, 100);
ImageDestroy($new);
ImageDestroy($file);
$file = imagecreatetruecolor($w, $h);
$new = imagecreatefromjpeg($img);
imagecopyresampled($file, $new, 0, 0, $x1, $y1, $width, $height, $file_width, $file_height);
imagewebp($file, $webp_thumb, 100);//335 строчка
ImageDestroy($new);
ImageDestroy($file);
