Directly use the request parameters

This commit is contained in:
Marc Delisle 2013-08-21 05:48:31 -04:00
parent 36e689a64b
commit aeaf96dc9a

View File

@ -30,9 +30,6 @@ require_once './libraries/db_table_exists.lib.php';
$request_params = array(
'cn',
'ct',
'newHeight',
'newWidth',
'resize',
'sql_query',
'transform_key',
'where_clause'
@ -102,11 +99,11 @@ if (isset($ct) && ! empty($ct)) {
PMA_downloadHeader($cn, $mime_type);
if (! isset($resize)) {
if (! isset($_REQUEST['resize'])) {
echo $row[$transform_key];
} else {
// if image_*__inline.inc.php finds that we can resize,
// it sets $resize to jpeg or png
// it sets the resize parameter to jpeg or png
$srcImage = imagecreatefromstring($row[$transform_key]);
$srcWidth = ImageSX($srcImage);
@ -114,20 +111,20 @@ if (! isset($resize)) {
// Check to see if the width > height or if width < height
// if so adjust accordingly to make sure the image
// stays smaller then the $newWidth and $newHeight
// stays smaller than the new width and new height
$ratioWidth = $srcWidth/$newWidth;
$ratioHeight = $srcHeight/$newHeight;
$ratioWidth = $srcWidth/$_REQUEST['newWidth'];
$ratioHeight = $srcHeight/$_REQUEST['newHeight'];
if ($ratioWidth < $ratioHeight) {
$destWidth = $srcWidth/$ratioHeight;
$destHeight = $newHeight;
$destHeight = $_REQUEST['newHeight'];
} else {
$destWidth = $newWidth;
$destWidth = $_REQUEST['newWidth'];
$destHeight = $srcHeight/$ratioWidth;
}
if ($resize) {
if ($_REQUEST['resize']) {
$destImage = ImageCreateTrueColor($destWidth, $destHeight);
}
@ -139,10 +136,10 @@ if (! isset($resize)) {
$destHeight, $srcWidth, $srcHeight
);
if ($resize == 'jpeg') {
if ($_REQUEST['resize'] == 'jpeg') {
ImageJPEG($destImage, null, 75);
}
if ($resize == 'png') {
if ($_REQUEST['resize'] == 'png') {
ImagePNG($destImage);
}
ImageDestroy($srcImage);