Hope u all will like!
<?php
// Get new dimensions
$RESuploadFolderPath = '';
extract($_REQUEST);
if($f){
if ( isset( $w , $h , $q ) )
{
$w = (int) $w;
$h = (int) $h;
$q = (int) $q;
$w = ( $w > 0 && $w < 1000 ) ? $w : 50;
$h = ( $h > 0 && $h < 1000 ) ? $h : 60;
$h = ( $h > 0 && $h <= 100 ) ? $h : 80;
}
else
{
$w = 50;
$h = 60;
$h = 80;
}
$filename = $RESuploadFolderPath.$f;
if ( is_file( $filename ) )
{
// 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);
}
else
{
echo 'Some Text Here :P ';
}
}
<?php
// Get new dimensions
$RESuploadFolderPath = '';
extract($_REQUEST);
if($f){
if ( isset( $w , $h , $q ) )
{
$w = (int) $w;
$h = (int) $h;
$q = (int) $q;
$w = ( $w > 0 && $w < 1000 ) ? $w : 50;
$h = ( $h > 0 && $h < 1000 ) ? $h : 60;
$h = ( $h > 0 && $h <= 100 ) ? $h : 80;
}
else
{
$w = 50;
$h = 60;
$h = 80;
}
$filename = $RESuploadFolderPath.$f;
if ( is_file( $filename ) )
{
// 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);
}
else
{
echo 'Some Text Here :P ';
}
}

Always welcome!
Comment