Merge pull request #564 from openclassify/fatihalp2

#1485 Middle size images not preserve ratio
This commit is contained in:
Fatih Alp 2020-05-17 01:16:20 +03:00 committed by GitHub
commit affe6f4678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 24 deletions

View File

@ -117,13 +117,13 @@ return [
'picture_width' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 900,
'default_value' => 600,
],
],
'picture_height' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 600,
'default_value' => 400,
],
],
'watermark_type' => [

View File

@ -14,13 +14,6 @@ return [
'default_value' => 600,
],
],
'imageResizeW' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => null,
],
],
'imageResizeH' => [
'type' => 'anomaly.field_type.integer',
'config' => [

View File

@ -60,22 +60,23 @@ class UploadController extends AdminController
$watermarktype = $settings->value('visiosoft.module.advs::watermark_type');
$position = $settings->value('visiosoft.module.advs::watermark_position');
$fullImg = WaterMark::make($this->request->file('upload')->getRealPath())
->resize(
setting_value('visiosoft.field_type.media::imageResizeW', null),
setting_value('visiosoft.field_type.media::imageResizeH', 600)
)
->resizeCanvas(
setting_value('visiosoft.field_type.media::imageCanvasW', 800),
setting_value('visiosoft.field_type.media::imageCanvasH', 600),
'center',
false,
'fff'
);
->resize(null, setting_value('visiosoft.field_type.media::imageResizeH', 600),function ($constraint) {
$constraint->aspectRatio();
})
->resizeCanvas(
setting_value('visiosoft.field_type.media::imageCanvasW', 800),
setting_value('visiosoft.field_type.media::imageCanvasH', 600),
'center', false, 'fff'
);
$mdImg = WaterMark::make($this->request->file('upload')->getRealPath())
->resize(
setting_value('visiosoft.module.advs::picture_width'),
setting_value('visiosoft.module.advs::picture_height')
);
->resize(null, setting_value('visiosoft.module.advs::picture_height'),function ($constraint) {
$constraint->aspectRatio();
})
->resizeCanvas(
setting_value('visiosoft.module.advs::picture_width', 400),
setting_value('visiosoft.module.advs::picture_height', 300),
'center', false, 'fff'
);
foreach ([$fullImg, $mdImg] as $index => $image) {
if ($watermarktype == 'image') {
$watermarkimage_id = $settings->value('visiosoft.module.advs::watermark_image');