header("Content-type: image/png");
$temp_width = 150;
$temp_height = 180;
$img_path = "test.jpg";
$img_path2 = "test2.jpg";
$im = @imagecreatefromjpeg($img_path);
$temp_img=imagecreatetruecolor($temp_width,$temp_height);
imagecopyresampled($temp_img,$im,0,0,0,0,$temp_width,$temp_height,$temp_width,$temp_height);
//echo $temp_img;
//imagejpeg($temp_img);
imagepng($im,$img_path2);
/*
imagecopyresized($temp_img,$im,0,0,0,0,$temp_width,$temp_height,$srcW,$srcH);
$ni=imagecreatetruecolor($width,$height);
imagecopyresampled
$res = function_exists('imagecreatetruecolor');
var_dump($res);
*/
?>