Sembra che prima la ridimensiona e poi la taglia

questo è il codice

Codice PHP:
$img =   imagecreatefromjpeg($_FILES['immagine']['tmp_name']);
    
$img_width imagesx($img);
    
$img_height imagesy($img);
    
$thumb_width 282;
    
$thumb_height = ($img_width != $thumb_width) ? floor($thumb_width $img_height $img_width) : $img_height;
    
$thumb imagecreatetruecolor($thumb_width$thumb_height);
    
imagecopyresized($thumb$img0000$thumb_width$thumb_height$img_width$img_height);
    
imagejpeg($thumb$dest."/".$data.$_FILES['immagine']['name'], 72);