Merge pull request #989 from openclassify/vedat

watermark settings
This commit is contained in:
Ozcan Durak 2021-03-12 10:52:14 +03:00 committed by GitHub
commit 850a104c36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 45 deletions

View File

@ -62,6 +62,7 @@ return [
'ads_image' => [ 'ads_image' => [
'title' => 'visiosoft.module.advs::section.ads_image', 'title' => 'visiosoft.module.advs::section.ads_image',
'fields' => [ 'fields' => [
'watermark',
'image_resize_backend', 'image_resize_backend',
'full_image_width', 'full_image_width',
'full_image_height', 'full_image_height',

View File

@ -295,6 +295,12 @@ return [
'default_value' => 600, 'default_value' => 600,
], ],
], ],
'watermark' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => false,
]
],
'watermark_type' => [ 'watermark_type' => [
'type' => 'anomaly.field_type.select', 'type' => 'anomaly.field_type.select',
'bind' => 'adv.watermark_type', 'bind' => 'adv.watermark_type',
@ -389,31 +395,31 @@ return [
}, },
], ],
], ],
'favicon' => [ 'favicon' => [
'type' => 'anomaly.field_type.file', 'type' => 'anomaly.field_type.file',
], ],
'ads_date_hidden' => [ 'ads_date_hidden' => [
'type' => 'anomaly.field_type.boolean', 'type' => 'anomaly.field_type.boolean',
'config' => [ 'config' => [
'default_value' => false, 'default_value' => false,
] ]
], ],
'hide_listing_header' => [ 'hide_listing_header' => [
'type' => 'anomaly.field_type.boolean', 'type' => 'anomaly.field_type.boolean',
'config' => [ 'config' => [
'default_value' => false, 'default_value' => false,
] ]
], ],
'hide_filter_section' => [ 'hide_filter_section' => [
'type' => 'anomaly.field_type.boolean', 'type' => 'anomaly.field_type.boolean',
'config' => [ 'config' => [
'default_value' => false, 'default_value' => false,
] ]
], ],
'hide_seller_info' => [ 'hide_seller_info' => [
'type' => 'anomaly.field_type.boolean', 'type' => 'anomaly.field_type.boolean',
'config' => [ 'config' => [
'default_value' => false, 'default_value' => false,
] ]
] ]
]; ];

View File

@ -247,4 +247,8 @@ return [
'name' => 'GET Categories', 'name' => 'GET Categories',
'instructions' => 'It represents the categories in which the GET property will be valid.' 'instructions' => 'It represents the categories in which the GET property will be valid.'
], ],
'watermark' => [
'name' => 'Watermark',
'instructions' => 'Is watermark active?'
],
]; ];

View File

@ -118,26 +118,28 @@ class UploadController extends AdminController
foreach ($image_types as $key => $image) { 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") { if ($key === "full") {