so i want to display data from database to preview using imageuploader js from cristianbayer, because i want to put it in post edit page, so i can change image which has been uploaded to database server. im using laravel btw.
see this pic : i want retrieve image data and put inside image preview section
this is my controller function
public function edit($id)
{
$products = Product::with(['users','categories','images'])->find($id);
return view('dashboard.admin.products.edit', compact('products'));
}
this is my html code to preview image :
<div class="input-field">
<div class="input-images-1"></div>
</div>
this is my javascript :
<script>
let preloaded = [
{id: 1, src: 'https://picsum.photos/500/500?random=1'},
{id: 2, src: 'https://picsum.photos/500/500?random=2'},
{id: 3, src: 'https://picsum.photos/500/500?random=3'},
{id: 4, src: 'https://picsum.photos/500/500?random=4'},
{id: 5, src: 'https://picsum.photos/500/500?random=5'},
{id: 6, src: 'https://picsum.photos/500/500?random=6'},
];
$('.input-images-1').imageUploader({
preloaded: preloaded,
imagesInputName: 'files',
maxSize: 2 * 1024 * 1024,
preloadedInputName: 'old',
maxFiles: 5
});
how to retrieve data from data base and put in preloaded image? or any other method i might be able to use?
any help will be greatly appreciated, thanks!