Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #4072 [要望] 画像をアップロードすると元画像より容量が大きくなる事がある問題を解決 #4073

Open
wants to merge 1 commit into
base: 5.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/app_local.example.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,6 @@
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
],
],
// thmbnailの解像度を変更する場合
// 'resizeResolution' => 72,
];
6 changes: 6 additions & 0 deletions plugins/baser-core/src/Vendor/Imageresizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ function resize($imgPath, $savePath = null, $newWidth = null, $newHeight = null,
@unlink($savePath);
}

// ConfigのresizeResolutionの値があって、デフォルト(96dpi)より小さい場合、解像度を上書きする
$resizeResolution = \Cake\Core\Configure::read('resizeResolution');
if (!empty($resizeResolution) && (int) $resizeResolution < 96 ){
imageresolution($newImage, $resizeResolution, $resizeResolution);
}

switch($image_type) {
case IMAGETYPE_GIF:
if ($savePath) {
Expand Down