changes to allow preview of image first

This commit is contained in:
Chris 2018-02-16 15:27:48 +00:00
parent 35085248b6
commit 4e37176436
3 changed files with 37 additions and 1 deletions

17
public/js/app.js vendored
View file

@ -45,6 +45,23 @@ $.when( $.ready ).then(function() {
}
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#appimage img').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#upload").change(function() {
readURL(this);
});
$( "#sortable" ).sortable({
stop: function (event, ui) {
var idsInOrder = $("#sortable").sortable('toArray', {

View file

@ -36,6 +36,23 @@ $.when( $.ready ).then(function() {
}
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#appimage img').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#upload").change(function() {
readURL(this);
});
$( "#sortable" ).sortable({
stop: function (event, ui) {
var idsInOrder = $("#sortable").sortable('toArray', {

View file

@ -43,11 +43,13 @@
?>
<img src="{{ asset('storage/'.$icon) }}" />
{!! Form::hidden('icon', $icon, ['class' => 'form-control']) !!}
@else
<img src="/img/heimdall-icon-small.png" />
@endif
</div>
<div class="upload-btn-wrapper">
<button class="btn">{{ __('app.buttons.upload')}} </button>
<input type="file" name="file" />
<input type="file" id="upload" name="file" />
</div>
</div>
</div>