1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 13:47:31 +02:00

Added e107::getThumb() to get thumbnailer class. Added a test for it. Styling fix for admin-ui grid.

This commit is contained in:
Cameron
2020-03-09 13:41:00 -07:00
parent 0ef918eb59
commit a200d312d8
4 changed files with 53 additions and 9 deletions

View File

@@ -1466,6 +1466,27 @@ class e107
} }
/**
* Retrieves PhpThumbFactory object
*
* @param $src
* @return bool|GdThumb
*/
public static function getThumb($src)
{
require_once(e_HANDLER.'phpthumb/ThumbLib.inc.php');
try
{
return PhpThumbFactory::create($src);
}
catch (Exception $e)
{
return false;
}
}
/** /**
* Retrieve e107Email mail mailer object. * Retrieve e107Email mail mailer object.
* *

View File

@@ -284,6 +284,18 @@ class e107Test extends \Codeception\Test\Unit
$this->assertTrue($res); $this->assertTrue($res);
}*/ }*/
public function testGetThumb()
{
$tmp = e107::getThumb(e_PLUGIN."gallery/images/horse.jpg");
$className = get_class($tmp);
$this->assertEquals('GdThumb', $className);
}
public function testGetUserSession() public function testGetUserSession()
{ {
$tmp = e107::getUserSession(); $tmp = e107::getUserSession();

View File

@@ -79,6 +79,9 @@ a.core-mainpanel-link-icon:hover { text-decoration: none; filter: none; }
.admin-ui-grid img.fallback { opacity: 0.3; } .admin-ui-grid img.fallback { opacity: 0.3; }
.admin-ui-grid img.thumbnail { max-width: 100%; height:auto; } .admin-ui-grid img.thumbnail { max-width: 100%; height:auto; }
.admin-ui-grid .panel-footer { font-size:1em; /*height:30px; overflow:hidden*/} .admin-ui-grid .panel-footer { font-size:1em; /*height:30px; overflow:hidden*/}
.admin-ui-grid .panel-footer a { overflow: hidden; white-space: nowrap; width: 88%; display: inline-block; }
/* /*

View File

@@ -361,10 +361,19 @@ class e_thumbpage
{ {
$start = microtime(true); $start = microtime(true);
} }
@require(e_HANDLER.'phpthumb/ThumbLib.inc.php');
try
// @require(e_HANDLER.'phpthumb/ThumbLib.inc.php');
if(!$thumb = e107::getThumb($this->_src_path))
{ {
$thumb = PhpThumbFactory::create($this->_src_path); if(getperms('0'))
{
echo "Couldn't load thumb factory";
}
return null;
}
$sizeUp = ($this->_request['w'] > 110 || $this->_request['aw'] > 110) ? true : false; // don't resizeUp the icon images. $sizeUp = ($this->_request['w'] > 110 || $this->_request['aw'] > 110) ? true : false; // don't resizeUp the icon images.
$thumb->setOptions(array( $thumb->setOptions(array(
'correctPermissions' => true, 'correctPermissions' => true,
@@ -373,12 +382,11 @@ class e_thumbpage
'interlace' => true // improves performance 'interlace' => true // improves performance
)); ));
} /* catch (Exception $e)
catch (Exception $e)
{ {
echo $e->getMessage(); echo $e->getMessage();
return $this; return $this;
} }*/
// Image Cropping by Quadrant. // Image Cropping by Quadrant.
if(!empty($options['c'])) // $quadrant T(op), B(ottom), C(enter), L(eft), R(right) if(!empty($options['c'])) // $quadrant T(op), B(ottom), C(enter), L(eft), R(right)