mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Fixes #4508 - adds image to location view (and google map, if address and API key exist)
This commit is contained in:
parent
22c4d79cfb
commit
cbc09f3a12
|
@ -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=
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -46,5 +46,9 @@ return [
|
|||
'level' => env('ROLLBAR_LEVEL', 'error'),
|
||||
],
|
||||
|
||||
'google' => [
|
||||
'maps_api_key' => env('GOOGLE_MAPS_API')
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue