contrainte des images de gamme

This commit is contained in:
Olivier Legat 2021-04-20 11:40:17 +02:00
parent 3635e5f6c0
commit dc5ef76bb6
3 changed files with 8 additions and 4 deletions

View file

@ -33,7 +33,9 @@ class RangesController extends Controller
$request->validate([
'name' => 'required|string|max:255',
'description' => 'required',
'picture' => 'image|mimes:jpeg,png,jpg|max:2048',
'picture' => 'image|mimes:jpeg,png,jpg|max:2048|dimensions:max-width=' .
config('theme.range_image_maxwidth') . ',max-height=' .
config('theme.range_image_maxheight'),
]);
$range = new Range();
@ -70,7 +72,9 @@ class RangesController extends Controller
$request->validate([
'name' => 'required|string|max:255',
'description' => 'required',
'picture' => 'image|mimes:jpeg,png,jpg|max:2048',
'picture' => 'image|mimes:jpeg,png,jpg|max:2048|dimensions:max-width=' .
config('theme.range_image_maxwidth') . ',max-height=' .
config('theme.range_image_maxheight'),
]);
$range = Range::findOrFail($id);

View file

@ -27,7 +27,7 @@
<textarea class="form-control" id="description" name="description" placeholder="Description *"></textarea>
</div>
<div class="form-group">
<label for="picture">Image <small class="text-muted">- JPEG/PNG, 2Mo max.</small></label></br>
<label for="picture">Image <small class="text-muted">- JPEG/PNG, 2Mo max. Dimensions {{ Config::get('theme.range_image_maxwidth') }} px par {{ Config::get('theme.range_image_maxheight') }} px</small></label></br>
<input type="file" id="picture" name="picture" accept="image/png, image/jpeg">
</div>
<div class="form-group">

View file

@ -31,7 +31,7 @@
<textarea class="form-control" id="description" name="description" placeholder="Description *">{{$range->description}}</textarea>
</div>
<div class="form-group">
<label for="picture">Image <small class="text-muted">- JPEG/PNG, 2Mo max.</small></label></br>
<label for="picture">Image <small class="text-muted">- JPEG/PNG, 2Mo max. Dimensions {{ Config::get('theme.range_image_maxwidth') }} px par {{ Config::get('theme.range_image_maxheight') }} px</small></label></br>
<input type="file" id="picture" name="picture" accept="image/png, image/jpeg">
@if ($range->picture !== null)
<br/>