try
list($width, $height) = getimagesize($image_tmp);
if (@eregi('\.jpg$', $image_tmp)){
$image = imagecreatefromjpeg($image_tmp);
}else if (@eregi('\.gif$', $image_tmp)){
$image = imagecreatefromgif($image_tmp);
}else if (@eregi('\.png$', $image_tmp)){
$image = imagecreatefrompng($image_tmp)...