inline thumbnails
This commit is contained in:
@@ -22,6 +22,10 @@ $Source$
|
||||
|
||||
2003-03-05 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* Documentation.html, faq 1.29 about the "duplicate field names" problem
|
||||
* transformation_wrapper.php3, libraries/defines_php.lib.php3,
|
||||
libraries/transformations/image_jpeg__inline.inc.php3:
|
||||
resized thumbnails
|
||||
TODO: doc
|
||||
|
||||
2003-03-03 Alexander M. Turek <rabus@users.sourceforge.net>
|
||||
* tbl_replace_fields.php3: Bugfix: User was unable to insert values
|
||||
|
@@ -10,6 +10,7 @@
|
||||
* 40006 instead of 4.0.6RC3
|
||||
* PMA_IS_WINDOWS (bool) - mark if phpMyAdmin running on windows
|
||||
* server
|
||||
* PMA_IS_GD2 (bool) - true is GD2 is present
|
||||
*/
|
||||
// phpMyAdmin release
|
||||
if (!defined('PMA_VERSION')) {
|
||||
@@ -45,5 +46,19 @@ if (!defined('PMA_IS_WINDOWS')) {
|
||||
}
|
||||
}
|
||||
|
||||
// Whether GD2 is present
|
||||
if (!defined('PMA_IS_GD2')) {
|
||||
if (function_exists("get_extension_funcs")) {
|
||||
$testGD = @get_extension_funcs("gd");
|
||||
if ($testGD && in_array("imagegd2",$testGD)) {
|
||||
define('PMA_IS_GD2', 1);
|
||||
} else {
|
||||
define('PMA_IS_GD2', 0);
|
||||
}
|
||||
unset($testGD);
|
||||
} else {
|
||||
define('PMA_IS_GD2', 0);
|
||||
}
|
||||
}
|
||||
// $__PMA_DEFINES_PHP_LIB__
|
||||
?>
|
||||
|
@@ -8,7 +8,12 @@ if (!defined('PMA_TRANSFORMATION_IMAGE_JPEG__INLINE')){
|
||||
function PMA_transformation_image_jpeg__inline($buffer, $options = array()) {
|
||||
include('./libraries/transformations/global.inc.php3');
|
||||
|
||||
if (PMA_IS_GD2) {
|
||||
//$transform_options = array ('string' => '<img src="transformation_wrapper.php3' . $options['wrapper_link'] . '&resize=1&suggested_size=' . (isset($options[0]) ? $options[0] : '100') . '" alt="[__BUFFER__]">');
|
||||
$transform_options = array ('string' => '<a href="transformation_wrapper.php3' . $options['wrapper_link'] . '" target="_blank"><img src="transformation_wrapper.php3' . $options['wrapper_link'] . '&resize=1&suggested_size=' . (isset($options[0]) ? $options[0] : '100') . '" alt="[__BUFFER__]" border="0"></a>');
|
||||
} else {
|
||||
$transform_options = array ('string' => '<img src="transformation_wrapper.php3' . $options['wrapper_link'] . '" alt="[__BUFFER__]" width="320" height="240">');
|
||||
}
|
||||
$buffer = PMA_transformation_global_html_replace($buffer, $transform_options);
|
||||
|
||||
return $buffer;
|
||||
|
@@ -53,7 +53,6 @@ if (!empty($message)) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines the url to return to in case of error in a sql statement
|
||||
*/
|
||||
@@ -138,6 +137,7 @@ if ($cfgRelation['commwork'] && $cfgRelation['mimework']) {
|
||||
* Sends http headers
|
||||
*/
|
||||
// Don't use cache (required for Opera)
|
||||
if (!isset($noheader)) {
|
||||
$GLOBALS['now'] = gmdate('D, d M Y H:i:s') . ' GMT';
|
||||
header('Expires: ' . $GLOBALS['now']); // rfc2616 - Section 14.21
|
||||
header('Last-Modified: ' . $GLOBALS['now']);
|
||||
@@ -146,8 +146,44 @@ header('Pragma: no-cache'); // HTTP/1.0
|
||||
// [MIME]
|
||||
$content_type = 'Content-Type: ' . (isset($mime_map[urldecode($transform_key)]['mimetype']) ? str_replace("_", "/", $mime_map[urldecode($transform_key)]['mimetype']) : $default_ct) . (isset($mime_options['charset']) ? $mime_options['charset'] : '');
|
||||
header($content_type);
|
||||
}
|
||||
|
||||
echo $row[urldecode($transform_key)];
|
||||
if (!isset($resize)) {
|
||||
echo $row[urldecode($transform_key)];
|
||||
} else {
|
||||
// if image_jpeg__inline.inc.php3 finds that we can resize,
|
||||
// it sets $resize to 1
|
||||
|
||||
$srcImage = imagecreatefromstring($row[urldecode($transform_key)]);
|
||||
$newWidth = $suggested_size;
|
||||
$newHeight = $suggested_size;
|
||||
$srcWidth = ImageSX( $srcImage );
|
||||
$srcHeight = ImageSY( $srcImage );
|
||||
|
||||
// the following portion of code checks to see if
|
||||
// the width > height or if width < height
|
||||
// if so it adjusts accordingly to make sure the image
|
||||
// stays smaller then the $newWidth and $newHeight
|
||||
|
||||
$ratioWidth = $srcWidth/$newWidth;
|
||||
$ratioHeight = $srcHeight/$newHeight;
|
||||
|
||||
if( $ratioWidth < $ratioHeight){
|
||||
$destWidth = $srcWidth/$ratioHeight;
|
||||
$destHeight = $newHeight;
|
||||
}else{
|
||||
$destWidth = $newWidth;
|
||||
$destHeight = $srcHeight/$ratioWidth;
|
||||
}
|
||||
|
||||
$destImage = ImageCreateTrueColor( $destWidth, $destHeight);
|
||||
ImageCopyResized( $destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight );
|
||||
|
||||
ImageJPEG( $destImage,"",75 );
|
||||
ImageDestroy( $srcImage );
|
||||
ImageDestroy( $destImage );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Close MySql non-persistent connections
|
||||
|
Reference in New Issue
Block a user