27
* Sets globals from $_REQUEST
29
$request_params = array(
39
foreach ($request_params as $one_request_param) {
40
if (isset($_REQUEST[$one_request_param])) {
41
$GLOBALS[$one_request_param] = $_REQUEST[$one_request_param];
27
47
* Get the list of the fields of the current table
29
49
PMA_DBI_select_db($db);
30
$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table), null, PMA_DBI_QUERY_STORE);
31
50
if (isset($where_clause)) {
32
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';', null, PMA_DBI_QUERY_STORE);
33
$row = PMA_DBI_fetch_assoc($result);
51
$result = PMA_DBI_query(
52
'SELECT * FROM ' . PMA_Util::backquote($table) . ' WHERE ' . $where_clause . ';',
56
$row = PMA_DBI_fetch_assoc($result);
35
$result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE);
36
$row = PMA_DBI_fetch_assoc($result);
58
$result = PMA_DBI_query(
59
'SELECT * FROM ' . PMA_Util::backquote($table) . ' LIMIT 1;',
63
$row = PMA_DBI_fetch_assoc($result);
42
69
} // end if (no record returned)
46
73
if ($cfgRelation['commwork'] && $cfgRelation['mimework']) {
47
74
$mime_map = PMA_getMime($db, $table);
48
$mime_options = PMA_transformation_getOptions((isset($mime_map[$transform_key]['transformation_options']) ? $mime_map[$transform_key]['transformation_options'] : ''));
75
$mime_options = PMA_transformation_getOptions(
76
isset($mime_map[$transform_key]['transformation_options'])
77
? $mime_map[$transform_key]['transformation_options'] : ''
50
80
foreach ($mime_options AS $key => $option) {
51
81
if (substr($option, 0, 10) == '; charset=') {
57
// For re-usability, moved http-headers and stylesheets
58
// to a seperate file. It can now be included by libraries/header.inc.php,
87
// Only output the http headers
88
$response = PMA_Response::getInstance();
89
$response->getHeader()->sendHttpHeaders();
61
require_once './libraries/header_http.inc.php';
63
if (isset($ct) && !empty($ct)) {
64
$content_type = 'Content-Type: ' . $ct;
92
if (isset($ct) && ! empty($ct)) {
66
$content_type = 'Content-Type: ' . (isset($mime_map[$transform_key]['mimetype']) ? str_replace('_', '/', $mime_map[$transform_key]['mimetype']) : $default_ct) . (isset($mime_options['charset']) ? $mime_options['charset'] : '');
68
header($content_type);
70
if (isset($cn) && !empty($cn)) {
71
header('Content-Disposition: attachment; filename=' . PMA_sanitize_filename($cn));
74
if (!isset($resize)) {
95
$mime_type = (isset($mime_map[$transform_key]['mimetype'])
96
? str_replace('_', '/', $mime_map[$transform_key]['mimetype'])
98
. (isset($mime_options['charset']) ? $mime_options['charset'] : '');
101
PMA_downloadHeader($cn, $mime_type);
103
if (! isset($resize)) {
75
104
echo $row[$transform_key];
77
106
// if image_*__inline.inc.php finds that we can resize,
88
117
$ratioWidth = $srcWidth/$newWidth;
89
118
$ratioHeight = $srcHeight/$newHeight;
91
if ($ratioWidth < $ratioHeight){
120
if ($ratioWidth < $ratioHeight) {
92
121
$destWidth = $srcWidth/$ratioHeight;
93
122
$destHeight = $newHeight;
100
129
$destImage = ImageCreateTrueColor($destWidth, $destHeight);
103
// ImageCopyResized($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight);
104
// better quality but slower:
105
ImageCopyResampled($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight);
132
// ImageCopyResized($destImage, $srcImage, 0, 0, 0, 0,
133
// $destWidth, $destHeight, $srcWidth, $srcHeight);
134
// better quality but slower:
136
$destImage, $srcImage, 0, 0, 0, 0, $destWidth,
137
$destHeight, $srcWidth, $srcHeight
107
140
if ($resize == 'jpeg') {
108
ImageJPEG($destImage, '', 75);
141
ImageJPEG($destImage, null, 75);
110
143
if ($resize == 'png') {
111
144
ImagePNG($destImage);