Jump to content

manic

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

manic's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I'm trying to build a php application which will allow me to resize, crop and rotate images. I was disappointed to find that rotation angle was not a parameter that I could specify for imagecopyresampled(). In order to rotate, it seems my only option is to rotate with imagerotate() and then apply imagecopyresampled for cropping and scaling. My concern is image quality. Not only am I resampling twice, but imagerotate() doesn't have a quality parameter, and the jpg compression it applies is quite noticable. For example, see: http://www.aerian.com/test/image_rotation/?degrees=28 or even: http://www.aerian.com/test/image_rotation/?degrees=0 (which applies the function with no rotation) Can anybody suggest a better way to rotate images without loosing quality, preferably with facilities for cropping and scaling at the same time. Many thanks,
  2. ooo! I found it! http://elouai.com/force-download.php <?php $filename = $_GET['file']; // required for IE, otherwise Content-disposition is ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); // addition by Jorg Weske $file_extension = strtolower(substr(strrchr($filename,"."),1)); if( $filename == "" ) { echo "<html><title>eLouai's Download Script</title><body>ERROR: download file NOT SPECIFIED. USE force-download.php?file=filepath</body></html>"; exit; } elseif ( ! file_exists( $filename ) ) { echo "<html><title>eLouai's Download Script</title><body>ERROR: File not found. USE force-download.php?file=filepath</body></html>"; exit; }; switch( $file_extension ) { case "pdf": $ctype="application/pdf"; break; case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "doc": $ctype="application/msword"; break; case "xls": $ctype="application/vnd.ms-excel"; break; case "ppt": $ctype="application/vnd.ms-powerpoint"; break; case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "jpeg": case "jpg": $ctype="image/jpg"; break; default: $ctype="application/force-download"; } header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: $ctype"); // change, added quotes to allow spaces in filenames, by Rajkumar Singh header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$filename"); exit(); ?>
  3. hmm. I'm afraid not. I've got <?php on the very first character of the first line, and nothing after the last ?>. There are no php tags anywhere else. This is the only code that I have on the page. I'm wondering if it is something to do with the readfile function - does this automatically send output as text? Is there something else I should be doing in my headers to force download. Perhaps there is a generic method to force the download box for any file type - this would be very useful...
  4. Hi, I want to force the download of a zip file, but first I want to run some php script to validate the download. I don't need to create or unpack the zip, just stream it from a php file. I have tried the following script, but all I get is the uncompiled code in the browser: <? //access validation code goes here $filename = "test.zip"; $myFile = "/home/site/public_html/test/test.zip"; header("Cache-Control: public, must-revalidate"); header("Pragma: hack"); header("Content-Type: application/zip"); header("Content-Length: " .(string)(filesize($myFile)) ); header('Content-Disposition: attachment; filename="'.$filename.'"'); header("Content-Transfer-Encoding: binary\n"); readfile($myFile); ?> how can I force the donload pop up for this zip folder? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.