A free open source IT asset/license management system
Fixes #4508 - adds image to location view (and google map, if address and API key exist)
snipecbc09f3a1202
diff --git a/.env.example b/.env.exampleindex de1672f871..4d2743acb8 100644--- a/.env.example+++ b/.env.example@@ -104,3 +104,4 @@ FILESYSTEM_DISK=localAPP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1ALLOW_IFRAMING=falseAPP_CIPHER=AES-256-CBC+GOOGLE_MAPS_API=diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.phpindex 368e5b9ee6..65b17474cc 100755--- a/app/Http/Controllers/LocationsController.php+++ b/app/Http/Controllers/LocationsController.php@@ -98,7 +98,7 @@ class LocationsController extends Controller$image = $request->file('image');$file_name = str_random(25).".".$image->getClientOriginalExtension();$path = public_path('uploads/locations/'.$file_name);- Image::make($image->getRealPath())->resize(200, null, function ($constraint) {+ Image::make($image->getRealPath())->resize(600, null, function ($constraint) {$constraint->aspectRatio();$constraint->upsize();})->save($path);@@ -216,7 +216,7 @@ class LocationsController extends Controller$file_name = $location->id.'-'.str_slug($image->getClientOriginalName()) . "." . $image->getClientOriginalExtension();if ($image->getClientOriginalExtension()!='svg') {- Image::make($image->getRealPath())->resize(500, null, function ($constraint) {+ Image::make($image->getRealPath())->resize(600, null, function ($constraint) {$constraint->aspectRatio();$constraint->upsize();})->save(app('locations_upload_path').$file_name);diff --git a/config/services.php b/config/services.phpindex fa5440c8fa..83b8cca3ee 100644--- a/config/services.php+++ b/config/services.php@@ -46,5 +46,9 @@ return ['level' => env('ROLLBAR_LEVEL', 'error'),],+ 'google' => [+ 'maps_api_key' => env('GOOGLE_MAPS_API')+ ],+];diff --git a/resources/views/locations/view.blade.php b/resources/views/locations/view.blade.phpindex 4628a58ca4..e60c33b300 100644--- a/resources/views/locations/view.blade.php+++ b/resources/views/locations/view.blade.php@@ -19,7 +19,7 @@@section('content')<div class="row">- <div class="col-md-12">+ <div class="col-md-9"><div class="box box-default"><div class="box-header with-border"><div class="box-heading">@@ -50,10 +50,49 @@</div></div></div>+ <div class="col-md-3">++++ @if ($location->image!='')+ <div class="col-md-12 text-center">+ <img src="{{ app('locations_upload_url') }}/{{ $location->image }}" class="img-responsive img-thumbnail" alt="{{ $location->name }}">+ </div>+ @endif+ <div class="col-md-12">+ <ul class="list-unstyled" style="line-height: 25px; padding-bottom: 20px;">+ @if ($location->address!='')+ <li>{{ $location->address }}</li>+ @endif+ @if ($location->address2!='')+ <li>{{ $location->address2 }}</li>+ @endif+ @if (($location->city!='') || ($location->state!='') || ($location->zip!=''))+ <li>{{ $location->city }} {{ $location->state }} {{ $location->zip }}</li>+ @endif+ @if (($location->manager))+ <li>{{ trans('admin/users/table.manager') }}: {!! $location->manager->present()->nameUrl() !!}</li>+ @endif+ @if (($location->parent))+ <li>{{ trans('admin/locations/table.parent') }}: {!! $location->parent->present()->nameUrl() !!}</li>+ @endif+ </ul>++ @if (($location->state!='') && ($location->country!='') && (config('services.google.maps_api_key')))+ <div class="col-md-12 text-center">+ <img src="https://maps.googleapis.com/maps/api/staticmap?center={{ urlencode($location->city.','.$location->city.' '.$location->state.' '.$location->country.' '.$location->zip) }}&size=500x300&maptype=roadmap&key={{ config('services.google.maps_api_key') }}" class="img-responsive img-thumbnail">+ </div>+ @endif+++ </div>+++ </div></div><div class="row">- <div class="col-md-12">+ <div class="col-md-9"><div class="box box-default"><div class="box-header with-border"><div class="box-heading">@@ -87,6 +126,9 @@</div></div></div>+++</div>@stop