<div class="card m-0 border">
<div class="card-body">
<div class="row photo-upload-holder">
<div class="col-md-6 d-flex align-items-stretch">
<div class="card m-0 w-100" style="min-height: 200px">
<div class="card-body d-flex justify-content-center">
<label class="btn btn-primary photo-upload-label align-self-center" for="{{'upload_'.$name}}"><i class="fa fa-file"></i> wybierz plik
<input name="{{$name}}" type="file" id="{{'upload_'.$name}}" accept="image/*" onchange="readURL(this);">
</label>
</div>
</div>
</div>
<div class="col-md-6 d-flex align-items-stretch">
<div class="card border m-0 w-100 photo-upload-preview" style="background-image: url({{$value ?? 'http://placehold.it/180'}})">
</div>
</div>
</div>
</div>
</div>
@push('js')
<script>
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$(input).closest('.photo-upload-holder')
.find('.photo-upload-preview')
.css('background-image', 'url(' + e.target.result + ')');
};
reader.readAsDataURL(input.files[0]);
}
}
</script>
@endpush
@push('style')
<style>
img{
max-width:180px;
}
.photo-upload-label {
cursor: pointer;
}
.photo-upload-label input[type=file]{
position: absolute;
bottom: -100px;
visibility: hidden;
}
.photo-upload-preview {
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
</style>
@endpush
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}