Add basic thumbnail handling with static image
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -36,6 +36,18 @@ class GlModelHandler extends ImageHandler {
|
||||
* @return MediaTransformOutput
|
||||
*/
|
||||
public function doTransform($image, $dstPath, $dstUrl, $params, $flags = 0) {
|
||||
$params['isFilePageThumb'] = false;
|
||||
if (!isset($params['width']) || $params['width'] == 0) {
|
||||
$params['width'] = 800;
|
||||
}
|
||||
if (!isset($params['height']) || $params['height'] == 0) {
|
||||
$params['height'] = 600;
|
||||
}
|
||||
|
||||
if ($params['width'] <= 300 || $params['height'] <= 300) {
|
||||
$params['isFilePageThumb'] = true;
|
||||
}
|
||||
|
||||
return new GlModelTransformOutput($image, $params);
|
||||
}
|
||||
|
||||
@@ -47,7 +59,10 @@ class GlModelHandler extends ImageHandler {
|
||||
* @return bool
|
||||
*/
|
||||
public function validateParam( $name, $value ) {
|
||||
if (in_array($name, ['width', 'height'])) {
|
||||
echo '<script>';
|
||||
self::console_log('Param: ' . $name . " = " . $value);
|
||||
echo '</script>';
|
||||
if (in_array($name, ['width', 'height'])) {
|
||||
return $value > 0;
|
||||
} else if (in_array($name, ['view', 'hsset'])) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user