diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 8586188f2..591358a7f 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -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. * diff --git a/e107_tests/tests/unit/e107Test.php b/e107_tests/tests/unit/e107Test.php index 5fe32b8f8..150c3bb67 100644 --- a/e107_tests/tests/unit/e107Test.php +++ b/e107_tests/tests/unit/e107Test.php @@ -284,6 +284,18 @@ class e107Test extends \Codeception\Test\Unit $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() { $tmp = e107::getUserSession(); diff --git a/e107_themes/bootstrap3/admin_style.css b/e107_themes/bootstrap3/admin_style.css index fa7b64cb7..9257bbf79 100644 --- a/e107_themes/bootstrap3/admin_style.css +++ b/e107_themes/bootstrap3/admin_style.css @@ -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.thumbnail { max-width: 100%; height:auto; } .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; } + + /* diff --git a/thumb.php b/thumb.php index 817a07a3f..971115934 100755 --- a/thumb.php +++ b/thumb.php @@ -361,24 +361,32 @@ class e_thumbpage { $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); - $sizeUp = ($this->_request['w'] > 110 || $this->_request['aw'] > 110) ? true : false; // don't resizeUp the icon images. - $thumb->setOptions(array( + 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. + $thumb->setOptions(array( 'correctPermissions' => true, 'resizeUp' => $sizeUp, 'jpegQuality' => $this->_thumbQuality, 'interlace' => true // improves performance )); - - } - catch (Exception $e) + + /* catch (Exception $e) { echo $e->getMessage(); return $this; - } + }*/ // Image Cropping by Quadrant. if(!empty($options['c'])) // $quadrant T(op), B(ottom), C(enter), L(eft), R(right)