1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-18 20:31:41 +02:00

Thumbnail tests added for cropping and PNG files.

This commit is contained in:
Cameron
2020-12-06 08:03:03 -08:00
parent 68a0c8940c
commit 1f38b3b3dd
4 changed files with 212 additions and 28 deletions

View File

@@ -54,6 +54,13 @@ class e_thumbnail
public function init($pref)
{
$this->parseRequest();
if(!empty($this->_request['noinit']))
{
return null;
}
$this->_watermark = array(
'activate' => vartrue($pref['watermark_activate'], false),
'text' => vartrue($pref['watermark_text']),
@@ -68,7 +75,8 @@ class e_thumbnail
$this->_thumbQuality = vartrue($pref['thumbnail_quality'],65);
$this->parseRequest();
}
/**
@@ -289,7 +297,6 @@ class e_thumbnail
elseif(!empty($this->_request['ah']))
{
//Typically gives a better result with images of people than adaptiveResize().
//TODO TBD Add Pref for Top, Bottom, Left, Right, Center?
$thumb->adaptiveResizeQuadrant((integer) vartrue($this->_request['aw'], 0), (integer) vartrue($this->_request['ah'], 0), 'T');
}
else
@@ -318,28 +325,21 @@ class e_thumbnail
$this->_watermark['font'] = $tp->createConstants($this->_watermark['font'], 'mix');
$this->_watermark['font'] = realpath($tp->replaceConstants($this->_watermark['font'],'rel'));
$thumb->watermarkText($this->_watermark);
// $thumb->WatermarkText($this->_watermark); // failing due to phpThumb::
}
// echo "hello";
//exit;
// set cache
$thumb->save($cache_filename);
$this->_request = array();
$this->_request = array(); // reset the request.
if($this->_debug === true)
if($this->_debug === true) // return the cache file path for testing.
{
return $cache_filename;
}
// show thumb
$thumb->show();