diff --git a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php index ab3f3904a..1336af80b 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/sections.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/sections.php @@ -63,6 +63,7 @@ return [ 'ads_image' => [ 'title' => 'visiosoft.module.advs::section.ads_image', 'fields' => [ + 'watermark', 'image_resize_backend', 'full_image_width', 'full_image_height', diff --git a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php index 436ca2ba6..af1b774f1 100644 --- a/addons/default/visiosoft/advs-module/resources/config/settings/settings.php +++ b/addons/default/visiosoft/advs-module/resources/config/settings/settings.php @@ -295,6 +295,12 @@ return [ 'default_value' => 600, ], ], + 'watermark' => [ + 'type' => 'anomaly.field_type.boolean', + 'config' => [ + 'default_value' => false, + ] + ], 'watermark_type' => [ 'type' => 'anomaly.field_type.select', 'bind' => 'adv.watermark_type', diff --git a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php index 7e06bcedb..2bf5e9497 100644 --- a/addons/default/visiosoft/advs-module/resources/lang/en/setting.php +++ b/addons/default/visiosoft/advs-module/resources/lang/en/setting.php @@ -249,5 +249,9 @@ return [ ], 'disable_sentry' => [ 'name' => 'Disable Sentry' - ] + ], + 'watermark' => [ + 'name' => 'Watermark', + 'instructions' => 'Is watermark active?' + ], ]; diff --git a/addons/default/visiosoft/media-field_type/src/Http/Controller/UploadController.php b/addons/default/visiosoft/media-field_type/src/Http/Controller/UploadController.php index 0fdc0bdf4..7ad894ff6 100644 --- a/addons/default/visiosoft/media-field_type/src/Http/Controller/UploadController.php +++ b/addons/default/visiosoft/media-field_type/src/Http/Controller/UploadController.php @@ -118,26 +118,28 @@ class UploadController extends AdminController foreach ($image_types as $key => $image) { - if ($settings_value['watermark_type'] == 'image') { + if (setting_value('visiosoft.module.advs::watermark', false)) { + if ($settings_value['watermark_type'] == 'image') { + + if ($watermarkimage = $this->files->find($settings_value['watermark_image'])) { + $watermark = WaterMark::make(app_storage_path() . '/files-module/local/' . $watermarkimage->path()); + $image->insert($watermark, $settings_value['watermark_position']); + } + + } else { + $v = "top"; + $h = "center"; + $w = $image->width() / 2; + $h1 = $image->height() / 2; + $font_size = $w / 20; + $image->text(($watermark_text = setting_value('visiosoft.module.advs::watermark_text')) ? $watermark_text : 'Openclassify', $w, $h1, function ($font) use ($v, $h, $font_size) { + $font->file(public_path('Antonio-Bold.ttf')); + $font->size($font_size); + $font->align($h); + $font->valign($v); + }); - if ($watermarkimage = $this->files->find($settings_value['watermark_image'])) { - $watermark = WaterMark::make(app_storage_path() . '/files-module/local/' . $watermarkimage->path()); - $image->insert($watermark, $settings_value['watermark_position']); } - - } else { - $v = "top"; - $h = "center"; - $w = $image->width() / 2; - $h1 = $image->height() / 2; - $font_size = $w / 20; - $image->text(($watermark_text = setting_value('visiosoft.module.advs::watermark_text')) ? $watermark_text : 'Openclassify', $w, $h1, function ($font) use ($v, $h, $font_size) { - $font->file(public_path('Antonio-Bold.ttf')); - $font->size($font_size); - $font->align($h); - $font->valign($v); - }); - } if ($key === "full") {