= 5.2.11 anymore // THIS DOESNT WORK ON SUSE 11.x ! // header('Content-type: aplication/octet-stream;'); // header('Content-type: ' . mime_content_type($fileLocation) . ';'); // header( "Content-Length: " . filesize($fileLocation)); // header('Content-Disposition: attachment; filename="' . $destFileName . '"'); // Do not send any header, rely on browser readfile($fileLocation); } /** * Create a thumb of image file in filesystem of server. * @param string origFileName Original image * @param string destFileName Thumb image * @param integer newWidth Thumb width * @param integer newHeight Thumb height */ function createthumb ($origFileName, $destFileName, $newWidth, $newHeight) { //TODO $newWidth and $newHeight values as percent. $system = explode(".",$origFileName); if (preg_match ("/jpg|jpeg/",$system[1])) $src_img = imagecreatefromjpeg($origFileName); if (preg_match ("/png/",$system[1])) $src_img = imagecreatefrompng($origFileName); $oldWidth = imageSX($src_img); $oldHeight = imageSY($src_img); $dst_img = ImageCreateTrueColor($newWidth, $newHeight); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $newWidth, $newHeight, $oldWidth, $oldHeight); if (preg_match("/png/",$system[1])) imagepng($dst_img,$destFileName); else imagejpeg($dst_img,$destFileName); imagedestroy($dst_img); imagedestroy($src_img); } ?>