diff --git a/public/js/app.js b/public/js/app.js index 47bc0b6b..a275c825 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -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', { diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 61f95bde..7570d7b4 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -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', { diff --git a/resources/views/items/form.blade.php b/resources/views/items/form.blade.php index 8110c93b..009e54c6 100644 --- a/resources/views/items/form.blade.php +++ b/resources/views/items/form.blade.php @@ -43,11 +43,13 @@ ?> {!! Form::hidden('icon', $icon, ['class' => 'form-control']) !!} + @else + @endif
- +