Merge branch 'rhymix:develop' into develop

This commit is contained in:
Soyu Kim 2023-06-30 20:40:51 +09:00 committed by GitHub
commit 4c73b1fa93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
209 changed files with 2643 additions and 1707 deletions

View file

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="0.2">
<title xml:lang="ko">첨부파일</title>
<title xml:lang="ko">파일</title>
<title xml:lang="zh-CN">附件管理</title>
<title xml:lang="en">Attachment</title>
<title xml:lang="en">File</title>
<title xml:lang="vi">Đính kèm</title>
<title xml:lang="es">Adjuntar archivos</title>
<title xml:lang="jp">添付ファイル</title>
<title xml:lang="es">Archivos</title>
<title xml:lang="jp">ファイル</title>
<title xml:lang="ru">Вложения</title>
<title xml:lang="zh-TW">附加檔案</title>
<title xml:lang="tr">Ekler</title>
<description xml:lang="ko">첨부 파일을 관리합니다.</description>
<description xml:lang="ko">문서 등에 첨부 파일을 관리합니다.</description>
<description xml:lang="zh-CN">管理附件的模块。</description>
<description xml:lang="en">Managing attachments.</description>
<description xml:lang="en">Manage files attached to documents and other data.</description>
<description xml:lang="vi">Module quản lý File đính kèm.</description>
<description xml:lang="es">Módulo para manejar los archivos adjuntos.</description>
<description xml:lang="jp">添付ファイルを管理するモジュールです。</description>

View file

@ -1081,7 +1081,7 @@ class FileController extends File
'width' => $image_info['width'],
'height' => $image_info['height'],
'type' => $image_info['type'],
'quality' => $config->image_quality_adjustment,
'quality' => $config->image_quality_adjustment ?: 75,
'rotate' => 0,
];
$is_animated = Rhymix\Framework\Image::isAnimatedGIF($file_info['tmp_name']);
@ -1234,11 +1234,14 @@ class FileController extends File
$adjusted['height'] -= $adjusted['height'] % 2;
// Convert using magick
$command = vsprintf('%s %s -resize %dx%d %s', [
$command = vsprintf('%s %s -resize %dx%d -quality %d %s %s %s', [
\RX_WINDOWS ? escapeshellarg($config->magick_command) : $config->magick_command,
escapeshellarg($file_info['tmp_name']),
$adjusted['width'],
$adjusted['height'],
intval($adjusted['quality'] ?: 75),
'-auto-orient -strip',
'-limit memory 64MB -limit map 128MB -limit disk 1GB',
escapeshellarg($output_name),
]);
@exec($command, $output, $return_var);
@ -1246,11 +1249,29 @@ class FileController extends File
}
else
{
// Try resizing with GD.
$result = FileHandler::createImageFile($file_info['tmp_name'], $output_name, $adjusted['width'], $adjusted['height'], $adjusted['type'], 'fill', $adjusted['quality'], $adjusted['rotate']);
// If the image cannot be resized using GD, try ImageMagick.
if (!$result && !empty($config->magick_command))
{
$command = vsprintf('%s %s -resize %dx%d -quality %d %s %s %s', [
\RX_WINDOWS ? escapeshellarg($config->magick_command) : $config->magick_command,
escapeshellarg($file_info['tmp_name']),
$adjusted['width'],
$adjusted['height'],
intval($adjusted['quality'] ?: 75),
'-auto-orient -strip',
'-limit memory 64MB -limit map 128MB -limit disk 1GB',
escapeshellarg($output_name),
]);
@exec($command, $output, $return_var);
$result = $return_var === 0 ? true : false;
}
}
// Change to information in the output file
if ($result)
if ($result && file_exists($output_name))
{
$file_info['tmp_name'] = $output_name;
$file_info['size'] = filesize($output_name);

View file

@ -126,7 +126,7 @@ $lang->ffmpeg_path = 'Absolute Path to ffmpeg';
$lang->ffprobe_path = 'Absolute Path to ffprobe';
$lang->magick_path = 'Absolute Path to magick';
$lang->about_ffmpeg_path = 'Rhymix uses ffmpeg to convert video files.';
$lang->about_magick_path = 'Rhymix uses magick to convert newer image formats such as AVIF and HEIC.<br />Note that the \'convert\' command from previous versions of ImageMagick doesn\'t support these formats.';
$lang->about_magick_path = 'Rhymix uses magick to convert newer image formats such as AVIF and HEIC.<br />Note that the \'convert\' command from previous versions of ImageMagick doesn\'t support these formats.<br />The latest version can be downloaded from their <a href="https://imagemagick.org/script/download.php" target="_blank">official site</a>.';
$lang->msg_cannot_use_ffmpeg = 'In order to use this feature, PHP must be able to execute \'ffmpeg\' and \'ffprobe\' commands.';
$lang->msg_cannot_use_exif = 'In order to use this feature, PHP must be installed with the \'exif\' extension.';
$lang->msg_need_magick = 'In order to handle AVIF and HEIC formats, PHP must be able to execute the \'magick\' command from ImageMagick 7.x or higher.';

View file

@ -129,7 +129,7 @@ $lang->ffmpeg_path = 'ffmpeg 절대경로';
$lang->ffprobe_path = 'ffprobe 절대경로';
$lang->magick_path = 'magick 절대경로';
$lang->about_ffmpeg_path = '동영상 변환에 사용합니다.';
$lang->about_magick_path = 'AVIF, HEIC 등 일부 이미지 변환에 사용합니다.<br />구 버전 ImageMagick의 convert 명령은 이러한 포맷을 지원하지 않습니다.';
$lang->about_magick_path = 'AVIF, HEIC 등 일부 이미지 변환에 사용합니다.<br />구 버전 ImageMagick의 convert 명령은 이러한 포맷을 지원하지 않습니다.<br />새 버전은 <a href="https://imagemagick.org/script/download.php" target="_blank">공식 사이트</a>에서 다운받을 수 있습니다.';
$lang->msg_cannot_use_ffmpeg = '이 기능을 사용하려면 PHP에서 ffmpeg 및 ffprobe 명령을 실행할 수 있어야 합니다.';
$lang->msg_cannot_use_exif = '이 기능을 사용하려면 PHP exif 확장모듈이 필요합니다.';
$lang->msg_need_magick = 'AVIF, HEIC 변환을 위해서는 PHP에서 ImageMagick 7.x 이상의 magick 명령을 실행할 수 있어야 합니다.';