- Add img control

This commit is contained in:
Vincent BRIDIER 2020-05-18 17:25:14 +02:00
parent f5e9838f68
commit 6d429d4a1f
3 changed files with 16 additions and 14 deletions

View file

@ -40,8 +40,8 @@ class EleveurController extends Controller
public function store(MyRequest $request)
{
$validatedData = $request->validate([
'photo1' => 'mimetypes:image/jpeg|max:500000',
'photo2' => 'mimetypes:image/jpeg|max:500000',
'photo1' => 'mimetypes:image/jpeg|max:1000',
'photo2' => 'mimetypes:image/jpeg|max:1000',
]);
@ -119,8 +119,8 @@ class EleveurController extends Controller
public function update(MyRequest $request, Eleveur $eleveur)
{
$validatedData = $request->validate([
'photo1' => 'mimetypes:image/jpeg|max:500000',
'photo2' => 'mimetypes:image/jpeg|max:500000',
'photo1' => 'mimetypes:image/jpeg|max:1000',
'photo2' => 'mimetypes:image/jpeg|max:1000',
]);
$datas = collect($request->all());

View file

@ -110,22 +110,23 @@
</div>
</div>
<div class="form-group row">
{!! Form::label('photo1', 'Photo 1', ['class' => 'col-sm-2 col-form-label']) !!}
{!! Form::label('photo1', 'Photo 1 (1Mo Max.)', ['class' => 'col-sm-2 col-form-label']) !!}
<div class="col-sm-10 photo">
{!! Form::file('photo1', ['class' => 'form-control']) !!}
<input class="form-control" name="photo1" type="file" id="photo1" accept="image/jpeg">
<input type="hidden" name="path_photo1_hidden" value="">
</div>
</div>
<div class="form-group row">
{!! Form::label('photo2', 'Photo 2', ['class' => 'col-sm-2 col-form-label']) !!}
{!! Form::label('photo2', 'Photo 2 (1Mo Max.)', ['class' => 'col-sm-2 col-form-label']) !!}
<div class="col-sm-10 photo">
{!! Form::file('photo2', ['class' => 'form-control']) !!}
<input class="form-control" name="photo2" type="file" id="photo2" accept="image/jpeg">
<input type="hidden" name="path_photo2_hidden" value="">
</div>
</div>
<div class="form-group" style="text-align:right; margin-top:20px;">
<input type="hidden" name="MAX_FILE_SIZE" value="1048576">
{!! Form::button('Enregistrer', ['type' => 'submit', 'id' => 'submitForm', 'class' => 'btn btn-outline-primary']) !!}
</div>
{!! Form::close() !!}
</div>
@endsection
@endsection

View file

@ -112,7 +112,7 @@
</div>
<div class="form-group row">
<div class="head col-sm-2 col-form-label">
{!! Form::label('photo1', 'Photo 1') !!}
{!! Form::label('photo1', 'Photo 1 (1Mo Max.)') !!}
@if ($eleveur->path_photo1 && $eleveur->path_photo1 != '')
<div class="icons">
<img src="/images/arrow_left.png" alt="" class="toRight">
@ -124,13 +124,13 @@
@if ($eleveur->path_photo1 && $eleveur->path_photo1 != '')
<img src="{{asset($eleveur->path_photo1)}}" alt="" class="photo1">
@endif
{!! Form::file('photo1', ['class' => 'form-control']) !!}
<input class="form-control" name="photo1" type="file" id="photo1" accept="image/jpeg">
<input type="hidden" name="path_photo1_hidden" value="{{$eleveur->path_photo1}}">
</div>
</div>
<div class="form-group row">
<div class="head col-sm-2 col-form-label">
{!! Form::label('photo2', 'Photo 2') !!}
{!! Form::label('photo2', 'Photo 2 (1Mo Max.)') !!}
@if ($eleveur->path_photo2 && $eleveur->path_photo2 != '')
<div class="icons">
<img src="/images/arrow_left.png" alt="" class="toRight2">
@ -142,11 +142,12 @@
@if ($eleveur->path_photo2 && $eleveur->path_photo2 != '')
<img src="{{asset($eleveur->path_photo2)}}" alt="" class="photo2">
@endif
{!! Form::file('photo2', ['class' => 'form-control']) !!}
<input class="form-control" name="photo2" type="file" id="photo2" accept="image/jpeg">
<input type="hidden" name="path_photo2_hidden" value="{{$eleveur->path_photo2}}">
</div>
</div>
<div class="form-group" style="text-align:right; margin-top:20px;">
<input type="hidden" name="MAX_FILE_SIZE" value="1048576">
{!! Form::button('Mettre à jour', ['type' => 'submit', 'id' => 'submitForm', 'class' => 'btn btn-outline-primary']) !!}
</div>
{!! Form::close() !!}
@ -228,4 +229,4 @@
})
})
</script>
@endsection
@endsection