View file wapbuzz downloads script/image.php

File size: 1Kb
<?php
// Get new dimensions
$RESuploadFolderPath = '';
extract($_REQUEST);
if($f){

$new_width = ($w ? $w : 50);
$new_height = ($h ? $h : 60);
$quality = ($q ? $q : 80);
$filename = $RESuploadFolderPath.$f;

// get original file's height & width
list($width, $height) = getimagesize($filename);
$filetype = pathinfo($filename);
$fileNameOnly = $filetype['filename'];

switch($filetype['extension'])
{
case 'jpg':
$source = imagecreatefromjpeg($filename);
break;
case 'gif';
$source = imagecreatefromgif($filename);
break;
case 'png':
$source = imagecreatefrompng($filename);
break;
}

$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $source, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

header('Content-type: image/jpeg');
header("Content-Disposition: attachment; filename=\"".$fileNameOnly."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
imagejpeg($image_p, null ,$quality);
}
?>