= 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. preg_match('/\.(jpg|jpeg|png)$/', $origFileName, $match); $extension = ''; if (!empty($match)) { $extension = $match[1]; } if (preg_match('/jpg|jpeg/', $extension)) { $src_img = imagecreatefromjpeg($origFileName); } if (preg_match('/png/', $extension)) { $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/', $extension)) { imagepng($dst_img, $destFileName); } else { imagejpeg($dst_img, $destFileName); } imagedestroy($dst_img); imagedestroy($src_img); }