mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge pull request #564 from openclassify/fatihalp2
#1485 Middle size images not preserve ratio
This commit is contained in:
commit
affe6f4678
@ -117,13 +117,13 @@ return [
|
|||||||
'picture_width' => [
|
'picture_width' => [
|
||||||
'type' => 'anomaly.field_type.integer',
|
'type' => 'anomaly.field_type.integer',
|
||||||
'config' => [
|
'config' => [
|
||||||
'default_value' => 900,
|
'default_value' => 600,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'picture_height' => [
|
'picture_height' => [
|
||||||
'type' => 'anomaly.field_type.integer',
|
'type' => 'anomaly.field_type.integer',
|
||||||
'config' => [
|
'config' => [
|
||||||
'default_value' => 600,
|
'default_value' => 400,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'watermark_type' => [
|
'watermark_type' => [
|
||||||
|
|||||||
@ -14,13 +14,6 @@ return [
|
|||||||
'default_value' => 600,
|
'default_value' => 600,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'imageResizeW' => [
|
|
||||||
'type' => 'anomaly.field_type.integer',
|
|
||||||
'config' => [
|
|
||||||
'default_value' => null,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'imageResizeH' => [
|
'imageResizeH' => [
|
||||||
'type' => 'anomaly.field_type.integer',
|
'type' => 'anomaly.field_type.integer',
|
||||||
'config' => [
|
'config' => [
|
||||||
|
|||||||
@ -60,22 +60,23 @@ class UploadController extends AdminController
|
|||||||
$watermarktype = $settings->value('visiosoft.module.advs::watermark_type');
|
$watermarktype = $settings->value('visiosoft.module.advs::watermark_type');
|
||||||
$position = $settings->value('visiosoft.module.advs::watermark_position');
|
$position = $settings->value('visiosoft.module.advs::watermark_position');
|
||||||
$fullImg = WaterMark::make($this->request->file('upload')->getRealPath())
|
$fullImg = WaterMark::make($this->request->file('upload')->getRealPath())
|
||||||
->resize(
|
->resize(null, setting_value('visiosoft.field_type.media::imageResizeH', 600),function ($constraint) {
|
||||||
setting_value('visiosoft.field_type.media::imageResizeW', null),
|
$constraint->aspectRatio();
|
||||||
setting_value('visiosoft.field_type.media::imageResizeH', 600)
|
})
|
||||||
)
|
->resizeCanvas(
|
||||||
->resizeCanvas(
|
setting_value('visiosoft.field_type.media::imageCanvasW', 800),
|
||||||
setting_value('visiosoft.field_type.media::imageCanvasW', 800),
|
setting_value('visiosoft.field_type.media::imageCanvasH', 600),
|
||||||
setting_value('visiosoft.field_type.media::imageCanvasH', 600),
|
'center', false, 'fff'
|
||||||
'center',
|
);
|
||||||
false,
|
|
||||||
'fff'
|
|
||||||
);
|
|
||||||
$mdImg = WaterMark::make($this->request->file('upload')->getRealPath())
|
$mdImg = WaterMark::make($this->request->file('upload')->getRealPath())
|
||||||
->resize(
|
->resize(null, setting_value('visiosoft.module.advs::picture_height'),function ($constraint) {
|
||||||
setting_value('visiosoft.module.advs::picture_width'),
|
$constraint->aspectRatio();
|
||||||
setting_value('visiosoft.module.advs::picture_height')
|
})
|
||||||
);
|
->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) {
|
foreach ([$fullImg, $mdImg] as $index => $image) {
|
||||||
if ($watermarktype == 'image') {
|
if ($watermarktype == 'image') {
|
||||||
$watermarkimage_id = $settings->value('visiosoft.module.advs::watermark_image');
|
$watermarkimage_id = $settings->value('visiosoft.module.advs::watermark_image');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user