Skip to content

A free open source IT asset/license management system

Fixed logo uploads

snipe412caebf691d
diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php
index 1651635263..fbfec2ce2c 100755
--- a/app/Http/Controllers/SettingsController.php
+++ b/app/Http/Controllers/SettingsController.php
@@ -409,17 +409,10 @@ class SettingsController extends Controller
}
- // If the user wants to clear the logo, reset the brand type
- if ('1' == $request->input('clear_logo')) {
- Storage::disk('public')->delete($setting->logo);
- $setting->logo = null;
- $setting->brand = 1;
-
- // If they are uploading an image, validate it and upload it
- } elseif ($request->hasFile('logo')) {
+ if ($request->hasFile('logo')) {
$image = $request->file('logo');
$ext = $image->getClientOriginalExtension();
- $setting->logo = $file_name = 'logo.' . $ext;
+ $setting->logo = $file_name = 'logo-.'.date('Y-m-d').'.'. $ext;
if ('svg' != $image->getClientOriginalExtension()) {
$upload = Image::make($image->getRealPath())->resize(null, 150, function ($constraint) {
@@ -435,15 +428,15 @@ class SettingsController extends Controller
if (($setting->logo) && (file_exists($file_name))) {
Storage::disk('public')->delete($file_name);
}
+
+ } elseif ('1' == $request->input('clear_logo')) {
+ Storage::disk('public')->delete($setting->logo);
+ $setting->logo = null;
+ $setting->brand = 1;
}
- // If the user wants to clear the email logo...
- if ('1' == $request->input('clear_email_logo')) {
- Storage::disk('public')->delete($setting->email_logo);
- $setting->email_logo = null;
- // If they are uploading an image, validate it and upload it
- } elseif ($request->hasFile('email_logo')) {
+ if ($request->hasFile('email_logo')) {
$email_image = $email_upload = $request->file('email_logo');
$email_ext = $email_image->getClientOriginalExtension();
$setting->email_logo = $email_file_name = 'email_logo.' . $email_ext;
@@ -462,15 +455,15 @@ class SettingsController extends Controller
if (($setting->email_logo) && (file_exists($email_file_name))) {
Storage::disk('public')->delete($email_file_name);
}
+ } elseif ('1' == $request->input('clear_email_logo')) {
+ Storage::disk('public')->delete($setting->email_logo);
+ $setting->email_logo = null;
+ // If they are uploading an image, validate it and upload it
}
- // If the user wants to clear the label logo...
- if ('1' == $request->input('clear_label_logo')) {
- Storage::disk('public')->delete($setting->label_logo);
- $setting->label_logo = null;
- // If they are uploading an image, validate it and upload it
- } elseif ($request->hasFile('label_logo')) {
+ // If the user wants to clear the label logo...
+ if ($request->hasFile('label_logo')) {
$image = $request->file('label_logo');
$ext = $image->getClientOriginalExtension();
$setting->label_logo = $label_file_name = 'label_logo.' . $ext;
@@ -489,15 +482,15 @@ class SettingsController extends Controller
if (($setting->label_logo) && (file_exists($label_file_name))) {
Storage::disk('public')->delete($label_file_name);
}
+ } elseif ('1' == $request->input('clear_label_logo')) {
+ Storage::disk('public')->delete($setting->label_logo);
+ $setting->label_logo = null;
+
+ // If they are uploading an image, validate it and upload it
}
// If the user wants to clear the favicon...
- if ('1' == $request->input('clear_favicon')) {
- Storage::disk('public')->delete($setting->clear_favicon);
- $setting->favicon = null;
-
- // If they are uploading an image, validate it and upload it
- } elseif ($request->hasFile('favicon')) {
+ if ($request->hasFile('favicon')) {
$favicon_image = $favicon_upload = $request->file('favicon');
$favicon_ext = $favicon_image->getClientOriginalExtension();
$setting->favicon = $favicon_file_name = 'favicon-uploaded.' . $favicon_ext;
@@ -524,7 +517,12 @@ class SettingsController extends Controller
if (($setting->favicon) && (file_exists($favicon_file_name))) {
Storage::disk('public')->delete($favicon_file_name);
}
- }
+ } elseif ('1' == $request->input('clear_favicon')) {
+ Storage::disk('public')->delete($setting->clear_favicon);
+ $setting->favicon = null;
+
+ // If they are uploading an image, validate it and upload it
+ }
if ($setting->save()) {
return redirect()->route('settings.index')
@@ -900,6 +898,7 @@ class SettingsController extends Controller
$setting->labels_pagewidth = $request->input('labels_pagewidth');
$setting->labels_pageheight = $request->input('labels_pageheight');
$setting->labels_display_company_name = $request->input('labels_display_company_name', '0');
+ $setting->labels_display_company_name = $request->input('labels_display_company_name', '0');
diff --git a/public/uploads/.gitignore b/public/uploads/.gitignore
index f935021a8f..73edf0327e 100755
--- a/public/uploads/.gitignore
+++ b/public/uploads/.gitignore
@@ -1 +1,2 @@
!.gitignore
+*
\ No newline at end of file
diff --git a/resources/lang/en/admin/settings/general.php b/resources/lang/en/admin/settings/general.php
index 2048f2df16..37af7fd1ca 100644
--- a/resources/lang/en/admin/settings/general.php
+++ b/resources/lang/en/admin/settings/general.php
@@ -144,6 +144,7 @@ return array(
'update' => 'Update Settings',
'value' => 'Value',
'brand' => 'Branding',
+ 'web_brand' => 'Web Branding Type',
'about_settings_title' => 'About Settings',
'about_settings_text' => 'These settings let you customize certain aspects of your installation.',
'labels_per_page' => 'Labels per page',
diff --git a/resources/views/settings/branding.blade.php b/resources/views/settings/branding.blade.php
index d8e342526c..15fa1266dc 100644
--- a/resources/views/settings/branding.blade.php
+++ b/resources/views/settings/branding.blade.php
@@ -58,36 +58,11 @@
</div>
- <!-- Logo -->
-
- <div class="form-group {{ $errors->has('image') ? 'has-error' : '' }}">
- <label class="col-md-3 control-label" for="image">
- {{ Form::label('logo', trans('admin/settings/general.logo')) }}</label>
- <div class="col-md-9">
- @if (config('app.lock_passwords'))
- <p class="help-block">{{ trans('general.lock_passwords') }}</p>
- @else
- <label class="btn btn-default">
- {{ trans('button.select_file') }}
- <input type="file" name="image" accept="image/gif,image/jpeg,image/png,image/svg" hidden>
- </label>
-
- <p class="help-block" id="upload-file-status">{{ trans('general.image_filetypes_help', ['size' => \App\Helpers\Helper::file_upload_max_size_readable()]) }}</p>
-
- {!! $errors->first('image', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
- <label for="clear_logo">
- {{ Form::checkbox('clear_logo', '1', old('clear_logo'),array('class' => 'minimal', 'aria-label'=>'clear_logo')) }}
- {{ trans('general.delete') }}
- </label>
- @endif
- </div>
- </div>
-
<!-- Branding -->
<div class="form-group {{ $errors->has('brand') ? 'error' : '' }}">
<div class="col-md-3">
- {{ Form::label('brand', trans('admin/settings/general.brand')) }}
+ {{ Form::label('brand', trans('admin/settings/general.web_brand')) }}
</div>
<div class="col-md-9">
{!! Form::select('brand', array('1'=>'Text','2'=>'Logo','3'=>'Logo + Text'), old('brand', $setting->brand), array('class' => 'form-control select2', 'style'=>'width: 150px ;')) !!}