Fix #1707 support thumbnail height value of 'auto' in any type

This commit is contained in:
Kijin Sung 2021-06-19 23:11:59 +09:00
parent 856f2af743
commit 633bc340e7
3 changed files with 16 additions and 10 deletions

View file

@ -1082,7 +1082,7 @@ class documentItem extends BaseObject
}
// If not specify its height, create a square
if(!$height)
if(!$height || (!ctype_digit($height) && $height !== 'auto'))
{
$height = $width;
}
@ -1091,7 +1091,7 @@ class documentItem extends BaseObject
$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
$thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type);
$thumbnail_url = Context::getRequestUri().$thumbnail_file;
$thumbnail_url = RX_BASEURL . $thumbnail_file;
$thumbnail_file = RX_BASEDIR . $thumbnail_file;
// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
@ -1166,7 +1166,7 @@ class documentItem extends BaseObject
}
if($file->cover_image === 'Y')
{
$source_file = $file->uploaded_filename;
$source_file = FileHandler::getRealPath($file->uploaded_filename);
break;
}
if(!$first_image)
@ -1176,7 +1176,7 @@ class documentItem extends BaseObject
}
if(!$source_file && $first_image)
{
$source_file = $first_image;
$source_file = FileHandler::getRealPath($first_image);
}
}
@ -1229,7 +1229,7 @@ class documentItem extends BaseObject
}
}
}
if($source_file)
{
$output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $trigger_obj->width, $trigger_obj->height, $trigger_obj->image_type, $trigger_obj->type, $trigger_obj->quality);