$w) { $new_x = $w; $new_y = $orig_y/($orig_x/$w); } $dst_img = ImageCreateTrueColor($new_x,$new_y); ImageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $new_x, $new_y, $orig_x, $orig_y); ImageJpeg($dst_img, "", $image_quality); if ($save=="yes") { $arr_file = explode("/",$file); $file = $arr_file[(count($arr_file)-1)]; $filename = "cache/".$w."_".$h."_".$file; ImageJpeg($dst_img,$filename, $image_quality); } ImageDestroy($src_img); ImageDestroy($dst_img); ?>