Skip to content

Commit

Permalink
fix baserproject#4072 [要望] 画像をアップロードすると元画像より容量が大きくなる事がある問題を解決
Browse files Browse the repository at this point in the history
  • Loading branch information
kato committed Dec 9, 2024
1 parent 8522806 commit 6b3b447
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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

0 comments on commit 6b3b447

Please sign in to comment.