From cbc09f3a1202412798534ca649d1e0eb0d629e2a Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 1 Dec 2017 19:12:35 -0800 Subject: [PATCH] Fixes #4508 - adds image to location view (and google map, if address and API key exist) --- .env.example | 1 + app/Http/Controllers/LocationsController.php | 4 +- config/services.php | 4 ++ resources/views/locations/view.blade.php | 46 +++++++++++++++++++- 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index de1672f87..4d2743acb 100644 --- a/.env.example +++ b/.env.example @@ -104,3 +104,4 @@ FILESYSTEM_DISK=local APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1 ALLOW_IFRAMING=false APP_CIPHER=AES-256-CBC +GOOGLE_MAPS_API= diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.php index 368e5b9ee..65b17474c 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.php index fa5440c8f..83b8cca3e 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.php index 4628a58ca..e60c33b30 100644 --- a/resources/views/locations/view.blade.php +++ b/resources/views/locations/view.blade.php @@ -19,7 +19,7 @@ @section('content')
-
+
@@ -50,10 +50,49 @@
+
+ + + + @if ($location->image!='') +
+ {{ $location->name }} +
+ @endif +
+
    + @if ($location->address!='') +
  • {{ $location->address }}
  • + @endif + @if ($location->address2!='') +
  • {{ $location->address2 }}
  • + @endif + @if (($location->city!='') || ($location->state!='') || ($location->zip!='')) +
  • {{ $location->city }} {{ $location->state }} {{ $location->zip }}
  • + @endif + @if (($location->manager)) +
  • {{ trans('admin/users/table.manager') }}: {!! $location->manager->present()->nameUrl() !!}
  • + @endif + @if (($location->parent)) +
  • {{ trans('admin/locations/table.parent') }}: {!! $location->parent->present()->nameUrl() !!}
  • + @endif +
+ + @if (($location->state!='') && ($location->country!='') && (config('services.google.maps_api_key'))) +
+ +
+ @endif + + +
+ + +
-
+
@@ -87,6 +126,9 @@
+ + +
@stop