mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Fix string * float error when height is auto #2562
This commit is contained in:
parent
8410e0ef14
commit
ab55d8f724
1 changed files with 18 additions and 5 deletions
|
|
@ -1146,9 +1146,14 @@ class DocumentItem extends BaseObject
|
|||
|
||||
// Call trigger for custom thumbnails.
|
||||
$trigger_obj = (object)[
|
||||
'document_srl' => $this->document_srl, 'width' => $width, 'height' => $height,
|
||||
'image_type' => 'jpg', 'type' => $thumbnail_type, 'quality' => $config->thumbnail_quality,
|
||||
'filename' => $thumbnail_file, 'url' => $thumbnail_url,
|
||||
'document_srl' => $this->document_srl,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'image_type' => 'jpg',
|
||||
'type' => $thumbnail_type,
|
||||
'quality' => $config->thumbnail_quality,
|
||||
'filename' => $thumbnail_file,
|
||||
'url' => $thumbnail_url,
|
||||
];
|
||||
$output = ModuleHandler::triggerCall('document.getThumbnail', 'before', $trigger_obj);
|
||||
clearstatcache(true, $thumbnail_file);
|
||||
|
|
@ -1220,8 +1225,16 @@ class DocumentItem extends BaseObject
|
|||
// If not exists, file an image file from the content
|
||||
if(!$source_file && $config->thumbnail_target !== 'attachment')
|
||||
{
|
||||
$external_image_min_width = min(100, round($trigger_obj->width * 0.3));
|
||||
$external_image_min_height = min(100, round($trigger_obj->height * 0.3));
|
||||
$external_image_min_width = is_numeric($trigger_obj->width) ? min(100, round(intval($trigger_obj->width) * 0.3)) : 100;
|
||||
if($trigger_obj->height === 'auto')
|
||||
{
|
||||
$external_image_min_height = min(100, $external_image_min_width * 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
$external_image_min_height = is_numeric($trigger_obj->height) ? min(100, round(intval($trigger_obj->height) * 0.3)) : 100;
|
||||
}
|
||||
|
||||
preg_match_all("!<img\s[^>]*?src=(\"|')([^\"' ]*?)(\"|')!is", $content, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $match)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue