image height crop
===

On my page I have a box (width: 240px, height:120px), and I must resize and crop the uploaded image. I need to crop the height of the uploaded image. (Note, the uploaded image is already been resized).

    if($width > $height){
       $tmp_width = 240;
       $tmp_height = 240 * ($width / $height);
    		
       $image = upload_image($_FILES['file']['name'], $_FILES['file']['tmp_name'], $unique, 'uploads/', true, $tmp_width, $tmp_height);
    		
       if($tmp_height > 120){
          $h = ($tmp_height / 2) - 60;
          $h2 = ($tmp_height / 2) + 60;
			
      $thumb = imagecreatetruecolor(240, 120);
      $src = imagecreatefromjpeg('uploads/'.$image);
      imagecopyresampled($thumb, $src, 0, $h, 0, $h2, 240, 120, 240, $tmp_height);
      imagejpeg($thumb, 'thumb_test.jpg', 90);
   }
}

I only get a black image (thumb_test.jpg).

I need to find the height of the image from the "middle" (y) of the image, and from there to move +60, -60 than crop to 240, 120.