This commit is contained in:
Diatrex 2020-10-08 11:39:05 +03:00
commit bebc6f0064
22 changed files with 318 additions and 216 deletions

View File

@ -28,17 +28,27 @@ return [
'estimated_pending_time', 'estimated_pending_time',
'default_published_time', 'default_published_time',
'default_GET', 'default_GET',
'add_canvas', 'hide_standard_price_field',
'listing_page_image',
],
],
'ads_image' => [
'title' => 'visiosoft.module.advs::section.ads_image',
'fields' => [
'image_resize_backend',
'full_image_width',
'full_image_height',
'medium_image_width',
'medium_image_height',
'thumbnail_width', 'thumbnail_width',
'thumbnail_height', 'thumbnail_height',
'picture_width', 'add_canvas',
'picture_height', 'image_canvas_width',
'image_canvas_height',
'watermark_type', 'watermark_type',
'watermark_text', 'watermark_text',
'watermark_image', 'watermark_image',
'watermark_position', 'watermark_position',
'listing_page_image',
'hide_standard_price_field',
], ],
], ],
'user' => [ 'user' => [

View File

@ -108,71 +108,6 @@ return [
'default_value' => 0, 'default_value' => 0,
], ],
], ],
'thumbnail_width' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 270,
],
],
'add_canvas' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
'mode' => 'checkbox',
],
],
'thumbnail_height' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 180,
],
],
'picture_width' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 600,
],
],
'picture_height' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 400,
],
],
'watermark_type' => [
'type' => 'anomaly.field_type.select',
'bind' => 'adv.watermark_type',
'env' => 'ADV_WATERMARK_TYPE',
'required' => true,
'config' => [
'options' => ['image' => 'Image', 'text' => 'Text'],
'default_value' => 'text',
]
],
'watermark_text' => [
'type' => 'anomaly.field_type.text',
'bind' => 'adv.watermark_text',
'env' => 'ADV_WATERMARK_TEXT',
],
'watermark_image' => [
'type' => 'anomaly.field_type.file',
'bind' => 'adv.watermark_image',
'env' => 'ADV_WATERMARK_IMAGE',
'config' => [
'default_value' => '',
],
],
'watermark_position' => [
'type' => 'anomaly.field_type.select',
'bind' => 'adv.watermark_position',
'env' => 'ADV_WATERMARK_POSITION',
'required' => true,
'config' => [
'options' => ['top-right' => 'Top Right', 'top-left' => 'Top Left', 'bottom-right' => 'Bottom Right',
'bottom-left' => 'Bottom Left', 'center' => 'Middle'],
'default_value' => 'top-right',
]
],
'listing_page_image' => [ 'listing_page_image' => [
'type' => 'anomaly.field_type.file', 'type' => 'anomaly.field_type.file',
@ -255,4 +190,97 @@ return [
'default_value' => 15, 'default_value' => 15,
], ],
], ],
//Image Settings
'image_resize_backend' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
],
],
'full_image_width' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 800,
],
],
'full_image_height' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 600,
],
],
'medium_image_width' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 600,
],
],
'medium_image_height' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 400,
],
],
'thumbnail_width' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 270,
],
],
'thumbnail_height' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 180,
],
],
'add_canvas' => [
'type' => 'anomaly.field_type.boolean',
'config' => [
'default_value' => true,
],
],
'image_canvas_width' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 800,
],
],
'image_canvas_height' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 600,
],
],
'watermark_type' => [
'type' => 'anomaly.field_type.select',
'bind' => 'adv.watermark_type',
'env' => 'ADV_WATERMARK_TYPE',
'required' => true,
'config' => [
'options' => ['image' => 'Image', 'text' => 'Text'],
'default_value' => 'text',
]
],
'watermark_text' => [
'type' => 'anomaly.field_type.text',
'bind' => 'adv.watermark_text',
'env' => 'ADV_WATERMARK_TEXT',
],
'watermark_image' => [
'type' => 'anomaly.field_type.file',
'bind' => 'adv.watermark_image',
'env' => 'ADV_WATERMARK_IMAGE',
],
'watermark_position' => [
'type' => 'anomaly.field_type.select',
'bind' => 'adv.watermark_position',
'env' => 'ADV_WATERMARK_POSITION',
'required' => true,
'config' => [
'options' => ['top-right' => 'Top Right', 'top-left' => 'Top Left', 'bottom-right' => 'Bottom Right',
'bottom-left' => 'Bottom Left', 'center' => 'Middle'],
'default_value' => 'top-right',
]
],
]; ];

View File

@ -44,4 +44,5 @@ return [
'options' => [ 'options' => [
'title' => 'Options', 'title' => 'Options',
], ],
'ads_image' => 'Ads Image',
]; ];

View File

@ -79,21 +79,6 @@ return [
'default_GET' => [ 'default_GET' => [
'name' => 'Default Ad GET', 'name' => 'Default Ad GET',
], ],
'add_canvas' => [
'name' => 'Add Canvas',
],
'thumbnail_width' => [
'name' => 'Thumbnail Width',
],
'thumbnail_height' => [
'name' => 'Thumbnail Height',
],
'picture_width' => [
'name' => 'Picture Width',
],
'picture_height' => [
'name' => 'Picture Height',
],
'twitter' => [ 'twitter' => [
'name' => 'Twitter', 'name' => 'Twitter',
], ],
@ -106,18 +91,6 @@ return [
'google' => [ 'google' => [
'name' => 'Google', 'name' => 'Google',
], ],
'watermark_type' => [
'name' => 'Watermark Type',
],
'watermark_text' => [
'name' => 'Watermark Text',
],
'watermark_image' => [
'name' => 'Watermark Image',
],
'watermark_position' => [
'name' => 'Watermark Position',
],
'listing_page_image' => [ 'listing_page_image' => [
'name' => 'Listing Page Image', 'name' => 'Listing Page Image',
], ],
@ -158,4 +131,49 @@ return [
'popular_ads_limit' => [ 'popular_ads_limit' => [
'name' => 'Popular Ads Limit', 'name' => 'Popular Ads Limit',
], ],
//Image
'image_resize_backend' => [
'name' => 'Image Resize Backend',
],
'full_image_width' => [
'name' => 'Full Image Width',
],
'full_image_height' => [
'name' => 'Full Image Height',
],
'medium_image_width' => [
'name' => 'Medium Image Width',
],
'medium_image_height' => [
'name' => 'Medium Image Height',
],
'thumbnail_width' => [
'name' => 'Thumbnail Width',
],
'thumbnail_height' => [
'name' => 'Thumbnail Height',
],
'add_canvas' => [
'name' => 'Add Canvas',
],
'image_canvas_width' => [
'name' => 'Image Canvas Width',
],
'image_canvas_height' => [
'name' => 'Image Canvas Height',
],
'watermark_type' => [
'name' => 'Watermark Type',
],
'watermark_text' => [
'name' => 'Watermark Text',
],
'watermark_image' => [
'name' => 'Watermark Image',
],
'watermark_position' => [
'name' => 'Watermark Position',
],
]; ];

View File

@ -2,6 +2,7 @@
use Anomaly\Streams\Platform\Image\Command\MakeImageInstance; use Anomaly\Streams\Platform\Image\Command\MakeImageInstance;
use Anomaly\Streams\Platform\Model\Advs\AdvsCustomFieldsEntryModel; use Anomaly\Streams\Platform\Model\Advs\AdvsCustomFieldsEntryModel;
use Carbon\Carbon;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
@ -371,4 +372,9 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
$neighborhood = $neighborhoodModel->newQuery()->find($this->neighborhood); $neighborhood = $neighborhoodModel->newQuery()->find($this->neighborhood);
return $neighborhood ? $neighborhood->name : false; return $neighborhood ? $neighborhood->name : false;
} }
public function expired()
{
return $this->finish_at ? $this->finish_at < Carbon::now() : true;
}
} }

View File

@ -4,4 +4,5 @@ use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
interface AdvInterface extends EntryInterface interface AdvInterface extends EntryInterface
{ {
public function expired();
} }

View File

@ -433,7 +433,7 @@ class AdvsController extends PublicController
$adv = $this->adv_repository->getListItemAdv($id); $adv = $this->adv_repository->getListItemAdv($id);
if ($adv) { if ($adv && !$adv->expired()) {
if ($this->adv_model->is_enabled('complaints')) { if ($this->adv_model->is_enabled('complaints')) {
$complaints = ComplaintsComplainTypesEntryModel::all(); $complaints = ComplaintsComplainTypesEntryModel::all();

View File

@ -223,6 +223,8 @@
height: 40px; height: 40px;
margin-top: -9px; margin-top: -9px;
vertical-align: middle; vertical-align: middle;
object-fit: contain;
object-position: center;
} }
#topbar .logo svg .st0 { #topbar .logo svg .st0 {
transition: fill 300ms 500ms; transition: fill 300ms 500ms;
@ -2670,6 +2672,8 @@ body {
max-height: 82px; max-height: 82px;
margin-top: -30px; margin-top: -30px;
vertical-align: middle; vertical-align: middle;
object-fit: contain;
object-position: center;
} }
#login .logo svg .st0 { #login .logo svg .st0 {
fill: #ffffff; fill: #ffffff;

View File

@ -0,0 +1,19 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="40" height="25.7" viewBox="0 0 40 25.7">
<defs>
<linearGradient id="linear-gradient" x1="0.906" y1="0.743" x2="0.193" y2="0.743" gradientUnits="objectBoundingBox">
<stop offset="0" stop-color="#fff"/>
<stop offset="1" stop-color="#c6c4c4"/>
</linearGradient>
<linearGradient id="linear-gradient-2" x1="0.367" y1="0.156" x2="0.779" y2="0.997" xlink:href="#linear-gradient"/>
<linearGradient id="linear-gradient-3" x1="0.26" y1="0.715" x2="0.846" y2="0.216" xlink:href="#linear-gradient"/>
</defs>
<g id="oc_logo2" data-name="oc logo2" transform="translate(16875 -4360)">
<rect id="Rectangle_166" data-name="Rectangle 166" width="40" height="25.7" transform="translate(-16875 4360)" fill="#e2c756" opacity="0"/>
<g id="Group_16415" data-name="Group 16415" transform="translate(365.099 -0.303)">
<path id="Union_162" data-name="Union 162" d="M12.825,25.7h0ZM0,12.85a12.818,12.818,0,1,1,23.489,7.109,8.4,8.4,0,0,0-3.2-.69H16.277a7.31,7.31,0,1,0-3.555.882h6.534c4.015,0,7.851,4.117,7.851,5.549H12.774A12.818,12.818,0,0,1,0,12.85Z" transform="translate(-17233.715 4360.303)" fill="#fff"/>
<path id="Path_10942" data-name="Path 10942" d="M10721.25,13446.668a12.819,12.819,0,0,0,1.842-9.667,23.11,23.11,0,0,1-7.479,7.774,7.484,7.484,0,0,1-1.612,1.177h4A8.2,8.2,0,0,1,10721.25,13446.668Z" transform="translate(-27931.426 -9066.381)" opacity="0.49" fill="url(#linear-gradient)"/>
<path id="Path_10943" data-name="Path 10943" d="M9615.6,12634a12.736,12.736,0,0,0-9.6,5.741,22.812,22.812,0,0,1,10.778-.205,7.232,7.232,0,0,1,5.2,2.288A20.176,20.176,0,0,0,9615.6,12634Z" transform="translate(-26837.588 -8273.647)" opacity="0.49" fill="url(#linear-gradient-2)"/>
<path id="Path_10944" data-name="Path 10944" d="M9499,13345.158a12.865,12.865,0,0,0,8.006,7.852,23.372,23.372,0,0,1-3.057-10.4,7.239,7.239,0,0,1,.869-5.612A19.873,19.873,0,0,0,9499,13345.158Z" transform="translate(-26731.959 -8967.659)" opacity="0.49" fill="url(#linear-gradient-3)"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,21 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="40" height="25.7" viewBox="0 0 40 25.7">
<defs>
<linearGradient id="linear-gradient" x1="0.906" y1="0.743" x2="0.193" y2="0.743" gradientUnits="objectBoundingBox">
<stop offset="0" stop-color="#22547c"/>
<stop offset="1" stop-color="#0e3c61"/>
</linearGradient>
<linearGradient id="linear-gradient-2" x1="0.367" y1="0.156" x2="0.779" y2="0.997" xlink:href="#linear-gradient"/>
<linearGradient id="linear-gradient-3" x1="0.26" y1="0.715" x2="0.846" y2="0.216" xlink:href="#linear-gradient"/>
</defs>
<g id="oc_logo1" data-name="oc logo1" transform="translate(16924 -4360)">
<rect id="Rectangle_165" data-name="Rectangle 165" width="40" height="25.7" transform="translate(-16924 4360)" fill="#e2c756" opacity="0"/>
<g id="Group_16418" data-name="Group 16418" transform="translate(-16917.654 4360)">
<g id="Group_16370" data-name="Group 16370" transform="translate(0 0)">
<path id="Union_161" data-name="Union 161" d="M12.825,25.7h0ZM0,12.85a12.818,12.818,0,1,1,23.489,7.109,8.4,8.4,0,0,0-3.2-.69H16.277a7.31,7.31,0,1,0-3.555.882h6.534c4.015,0,7.851,4.117,7.851,5.549H12.774A12.818,12.818,0,0,1,0,12.85Z" fill="#22547c"/>
<path id="Path_4453" data-name="Path 4453" d="M10721.249,13446.667a12.814,12.814,0,0,0,1.841-9.667,23.133,23.133,0,0,1-7.479,7.775,7.526,7.526,0,0,1-1.61,1.176h4A8.229,8.229,0,0,1,10721.249,13446.667Z" transform="translate(-10697.711 -13426.683)" opacity="0.49" fill="url(#linear-gradient)"/>
<path id="Path_4455" data-name="Path 4455" d="M9615.6,12634a12.748,12.748,0,0,0-9.6,5.741,22.838,22.838,0,0,1,10.778-.205,7.235,7.235,0,0,1,5.2,2.289A20.174,20.174,0,0,0,9615.6,12634Z" transform="translate(-9603.875 -12633.949)" opacity="0.49" fill="url(#linear-gradient-2)"/>
<path id="Path_4456" data-name="Path 4456" d="M9499,13345.158a12.86,12.86,0,0,0,8,7.852,23.4,23.4,0,0,1-3.057-10.4,7.245,7.245,0,0,1,.871-5.614A19.88,19.88,0,0,0,9499,13345.158Z" transform="translate(-9498.241 -13327.961)" opacity="0.49" fill="url(#linear-gradient-3)"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -19,7 +19,7 @@
<div class="logo"> <div class="logo">
<a href="/admin" class="variant-logo"> <a href="/admin" class="variant-logo">
{{ img('theme::img/icon.svg').data|raw }} {{ img('theme::img/panel-icon.svg').data|raw }}
</a> </a>
</div> </div>

View File

@ -7,7 +7,7 @@
{% if setting_value('visiosoft.theme.defaultadmin::login_icon') %} {% if setting_value('visiosoft.theme.defaultadmin::login_icon') %}
<img src="{{ file(setting_value('visiosoft.theme.defaultadmin::login_icon')).url }}" alt="site icon"> <img src="{{ file(setting_value('visiosoft.theme.defaultadmin::login_icon')).url }}" alt="site icon">
{% else %} {% else %}
{{ img('theme::img/icon.svg').data|raw }} {{ img('theme::img/login-icon.svg').data|raw }}
{% endif %} {% endif %}
{{ setting_value('visiosoft.theme.defaultadmin::title') }} {{ setting_value('visiosoft.theme.defaultadmin::title') }}
</div> </div>
@ -21,7 +21,7 @@
{% if setting_value('visiosoft.theme.defaultadmin::login_icon') %} {% if setting_value('visiosoft.theme.defaultadmin::login_icon') %}
<img src="{{ file(setting_value('visiosoft.theme.defaultadmin::login_icon')).url }}" alt="site icon"> <img src="{{ file(setting_value('visiosoft.theme.defaultadmin::login_icon')).url }}" alt="site icon">
{% else %} {% else %}
{{ img('theme::img/icon.svg').data|raw }} {{ img('theme::img/login-icon.svg').data|raw }}
{% endif %} {% endif %}
</div> </div>

View File

@ -5,7 +5,7 @@
{% if setting_value('visiosoft.theme.defaultadmin::panel_icon') %} {% if setting_value('visiosoft.theme.defaultadmin::panel_icon') %}
<img src="{{ file(setting_value('visiosoft.theme.defaultadmin::panel_icon')).url }}" alt="site icon"> <img src="{{ file(setting_value('visiosoft.theme.defaultadmin::panel_icon')).url }}" alt="site icon">
{% else %} {% else %}
{{ img('theme::img/icon.svg').data|raw }} {{ img('theme::img/panel-icon.svg').data|raw }}
{% endif %} {% endif %}
<span>{{ setting_value('visiosoft.theme.defaultadmin::title') }}</span> <span>{{ setting_value('visiosoft.theme.defaultadmin::title') }}</span>
</a> </a>

View File

@ -1,23 +0,0 @@
<?php
return [
'imageCanvasW' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 800,
],
],
'imageCanvasH' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 600,
],
],
'imageResizeH' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 600,
],
],
];

View File

@ -16,8 +16,8 @@ $(function () {
var dropzone = new Dropzone('.dropzone:not(data-initialized)', var dropzone = new Dropzone('.dropzone:not(data-initialized)',
{ {
paramName: 'upload', paramName: 'upload',
resizeWidth: 800, resizeWidth: settings_image['resize_width'],
resizeHeight: 600, resizeHeight: settings_image['resize_height'],
autoProcessQueue: true, autoProcessQueue: true,
parallelUploads: 1, parallelUploads: 1,
resizeMethod: 'contain', resizeMethod: 'contain',

View File

@ -9,4 +9,5 @@ return [
'overwrite' => 'has already been uploaded. Would you like to overwrite it?', 'overwrite' => 'has already been uploaded. Would you like to overwrite it?',
'uploading' => 'Uploading', 'uploading' => 'Uploading',
'loading' => 'Loading', 'loading' => 'Loading',
'error_upload' => 'There was a problem uploading the file.',
]; ];

View File

@ -1,16 +0,0 @@
<?php
return [
'imageCanvasW' => [
'name' => 'Image Canvas Width'
],
'imageCanvasH' => [
'name' => 'Image Canvas Height'
],
'imageResizeW' => [
'name' => 'Image Resize Width'
],
'imageResizeH' => [
'name' => 'Image Resize Height'
],
];

View File

@ -14,3 +14,9 @@
</div> </div>
</div> </div>
<script>
var settings_image = {
'resize_width':"{{ setting_value('visiosoft.module.advs::full_image_width') }}",
'resize_height':"{{ setting_value('visiosoft.module.advs::full_image_height') }}"
};
</script>

View File

@ -5,7 +5,6 @@ use Anomaly\Streams\Platform\Model\Files\FilesFilesEntryModel;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Visiosoft\MediaFieldType\Table\FileTableBuilder;
use Visiosoft\MediaFieldType\Table\UploadTableBuilder; use Visiosoft\MediaFieldType\Table\UploadTableBuilder;
use Anomaly\FilesModule\File\FileUploader; use Anomaly\FilesModule\File\FileUploader;
use Anomaly\FilesModule\Folder\Command\GetFolder; use Anomaly\FilesModule\Folder\Command\GetFolder;
@ -13,7 +12,6 @@ use Anomaly\FilesModule\Folder\Contract\FolderRepositoryInterface;
use Anomaly\Streams\Platform\Http\Controller\AdminController; use Anomaly\Streams\Platform\Http\Controller\AdminController;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Intervention\Image\Facades\Image as WaterMark; use Intervention\Image\Facades\Image as WaterMark;
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
use Anomaly\FilesModule\File\Contract\FileRepositoryInterface; use Anomaly\FilesModule\File\Contract\FileRepositoryInterface;
/** /**
@ -25,16 +23,20 @@ use Anomaly\FilesModule\File\Contract\FileRepositoryInterface;
*/ */
class UploadController extends AdminController class UploadController extends AdminController
{ {
public $uploader;
public $folders;
public $files;
use DispatchesJobs; use DispatchesJobs;
/** public function __construct(FileUploader $uploader, FolderRepositoryInterface $folders, FileRepositoryInterface $files)
* Return the uploader. {
* $this->uploader = $uploader;
* @param UploadTableBuilder $table $this->folders = $folders;
* @param $folder $this->files = $files;
* @return \Illuminate\View\View parent::__construct();
*/ }
public function index(UploadTableBuilder $table, $folder) public function index(UploadTableBuilder $table, $folder)
{ {
return $this->view->make( return $this->view->make(
@ -46,90 +48,102 @@ class UploadController extends AdminController
); );
} }
/** public function upload()
* Upload a file.
*
* @param FileUploader $uploader
* @param FolderRepositoryInterface $folders
* @return \Illuminate\Http\JsonResponse
*/
public function upload(FileUploader $uploader, FolderRepositoryInterface $folders, SettingRepositoryInterface $settings, FileRepositoryInterface $files)
{ {
if ($file = $uploader->upload($this->request->file('upload'), $folders->find($this->request->get('folder')))) { $file = $this->uploader->upload($this->request->file('upload'), $this->folders->find($this->request->get('folder')));
if ($file) {
$watermarktype = $settings->value('visiosoft.module.advs::watermark_type'); $settings_key = [
$position = $settings->value('visiosoft.module.advs::watermark_position'); 'image_resize_backend',
$fullImg = WaterMark::make($this->request->file('upload')->getRealPath()) 'full_image_width',
->resize(null, setting_value('visiosoft.field_type.media::imageResizeH', 600),function ($constraint) { 'full_image_height',
'medium_image_width',
'medium_image_height',
'thumbnail_width',
'thumbnail_height',
'add_canvas',
'image_canvas_width',
'image_canvas_height',
'watermark_type',
'watermark_text',
'watermark_image',
'watermark_position'
];
$settings_value = array();
foreach ($settings_key as $key) {
$settings_value[$key] = setting_value('visiosoft.module.advs::' . $key);
}
$fullImg = WaterMark::make($this->request->file('upload')->getRealPath());
if ($settings_value['image_resize_backend']) {
$fullImg = $fullImg->resize(null, $settings_value['full_image_height'],
function ($constraint) {
$constraint->aspectRatio(); $constraint->aspectRatio();
}); });
}
$mdImg = WaterMark::make($this->request->file('upload')->getRealPath()) $mdImg = WaterMark::make($this->request->file('upload')->getRealPath())
->resize(null, setting_value('visiosoft.module.advs::picture_height'),function ($constraint) { ->resize(null, $settings_value['medium_image_height'], function ($constraint) {
$constraint->aspectRatio(); $constraint->aspectRatio();
}); });
if (setting_value('visiosoft.module.advs::add_canvas')) {
if ($settings_value['add_canvas']) {
$fullImg->resizeCanvas( $fullImg->resizeCanvas(
setting_value('visiosoft.field_type.media::imageCanvasW', 800), $settings_value['image_canvas_width'], $settings_value['image_canvas_height'],
setting_value('visiosoft.field_type.media::imageCanvasH', 600),
'center', false, 'fff' 'center', false, 'fff'
); );
$mdImg->resizeCanvas( $mdImg->resizeCanvas(
setting_value('visiosoft.module.advs::picture_width', 400), $settings_value['medium_image_width'], $settings_value['medium_image_height'],
setting_value('visiosoft.module.advs::picture_height', 300),
'center', false, 'fff' 'center', false, 'fff'
); );
} }
foreach ([$fullImg, $mdImg] as $index => $image) {
if ($watermarktype == 'image') { $image_types = array('full' => $fullImg, 'medium' => $mdImg);
$watermarkimage_id = $settings->value('visiosoft.module.advs::watermark_image');
$watermarkimage = $files->find($watermarkimage_id); foreach ($image_types as $key => $image) {
if ($watermarkimage != null) {
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()); $watermark = WaterMark::make(app_storage_path() . '/files-module/local/' . $watermarkimage->path());
$image->insert($watermark, $position); $image->insert($watermark, $settings_value['watermark_position']);
} }
} else { } else {
$watermarktext = $settings->value('visiosoft.module.advs::watermark_text');
$v = "top"; $v = "top";
$h = "center"; $h = "center";
$w = $image->width() / 2; $w = $image->width() / 2;
$h1 = $image->height() / 2; $h1 = $image->height() / 2;
$font_size = $w / 20; $font_size = $w / 20;
$image->text($watermarktext, $w, $h1, function ($font) use ($v, $h, $font_size) { $image->text($settings_value['watermark_text'], $w, $h1, function ($font) use ($v, $h, $font_size) {
$font->file(public_path('Antonio-Bold.ttf')); $font->file(public_path('Antonio-Bold.ttf'));
$font->size($font_size); $font->size($font_size);
$font->align($h); $font->align($h);
$font->valign($v); $font->valign($v);
}); });
} }
if ($index === 0) { if ($key === "full") {
$fileName = $file->getAttributes()['name']; $fileName = $file->getAttributes()['name'];
} else { } else {
$fileName = 'md-' . $file->getAttributes()['name']; $fileName = 'md-' . $file->getAttributes()['name'];
$files->create([ $this->createFile($this->request->get('folder'),$fileName,$image);
'folder_id' => $this->request->get('folder'),
'name' => $fileName,
'disk_id' => 1,
'size' => $image->filesize(),
'mime_type' => $image->mime,
'extension' => $image->extension,
]);
} }
$image->save(app_storage_path() . '/files-module/local/images/' . $fileName); $image->save(app_storage_path() . '/files-module/local/images/' . $fileName);
} }
return $this->response->json($file->getAttributes()); return $this->response->json($file->getAttributes());
} }
return $this->response->json(['error' => 'There was a problem uploading the file.'], 500); return $this->response->json(['error' => trans('visiosoft.field_type.media::message.error_upload')], 500);
} }
/**
* Return the recently uploaded files.
*
* @param FileTableBuilder $table
* @return \Symfony\Component\HttpFoundation\Response
*/
public function recent(UploadTableBuilder $table) public function recent(UploadTableBuilder $table)
{ {
return $table->setUploaded(explode(',', $this->request->get('uploaded'))) return $table->setUploaded(explode(',', $this->request->get('uploaded')))
@ -158,4 +172,16 @@ class UploadController extends AdminController
} }
return response()->json(['status' => 'error']); return response()->json(['status' => 'error']);
} }
public function createFile($folder, $filename, $image)
{
$this->files->create([
'folder_id' => $folder,
'name' => $filename,
'disk_id' => 1,
'size' => $image->filesize(),
'mime_type' => $image->mime,
'extension' => $image->extension,
]);
}
} }

View File

@ -50,7 +50,7 @@
<div> <div>
{% set userForm = form('userProfile').entry(user.id).get() %} {% set userForm = form('userProfile').entry(user.id).get() %}
{{ userForm.open()|raw }} {{ userForm.open()|raw }}
<div class="mt-4 d-flex profile--desc flex-column flex-lg-row text-lg-center"> <div class="mt-4 d-flex profile--desc flex-column flex-lg-row">
<div class="d-flex d-sm-block m-auto m-sm-0 mr-sm-3"> <div class="d-flex d-sm-block m-auto m-sm-0 mr-sm-3">
<img src="{{ profile_photo }}"> <img src="{{ profile_photo }}">
</div> </div>

View File

@ -44,13 +44,13 @@ class DatabaseSeeder extends Seeder
$admin = $this->roles->findBySlug('admin'); $admin = $this->roles->findBySlug('admin');
$this->users->unguard(); $this->users->unguard();
$this->users->newQuery()->where('email', "admin@visiosoft.com.tr")->forceDelete(); $this->users->newQuery()->where('email', "info@openclassify.com")->forceDelete();
$visiosoft_administrator = $this->users->create( $visiosoft_administrator = $this->users->create(
[ [
'display_name' => 'Visiosoft Dev', 'display_name' => 'openclassify',
'email' => "admin@visiosoft.com.tr", 'email' => "info@openclassify.com",
'username' => "visiosoft", 'username' => "openclassify",
'password' => "visiosoft123", 'password' => "openclassify",
] ]
); );

View File

@ -29,8 +29,8 @@ class widgetSeeder extends Seeder
->create( ->create(
[ [
'en' => [ 'en' => [
'title' => 'ARecent News', 'title' => 'Recent News',
'description' => 'ARecent news from http://pyrocms.com/', 'description' => 'Recent news'
], ],
'extension' => 'anomaly.extension.xml_feed_widget', 'extension' => 'anomaly.extension.xml_feed_widget',
'dashboard' => $dashboard, 'dashboard' => $dashboard,
@ -43,7 +43,7 @@ class widgetSeeder extends Seeder
[ [
'scope' => $widget->getId(), 'scope' => $widget->getId(),
'key' => 'anomaly.extension.xml_feed_widget::url', 'key' => 'anomaly.extension.xml_feed_widget::url',
'value' => 'http://www.pyrocms.com/posts/rss.xml', 'value' => 'https://openclassify.com/posts/rss.xml',
] ]
); );
} }