Skip to content
Advertisement

Image Preview from DB

I’m Trying to Preview images from database as im saving album in table albums and album images in table images and connecting with relation but i can’t preview the images from table image so i’m adding relations between the 2 tables and trying to preview the images but its not working with me something went wrong but i cannot figure it

Blade.php

JavaScript

AlbumsController

JavaScript

Image Model

JavaScript

Album Model

JavaScript

table images Migration

JavaScript

Table albums Migration

JavaScript

Advertisement

Answer

<img style="width:5vw; hieght:5vh" src="{{$album->id}}" alt="">

  1. Do you have image with that id with no file extension at the end like {{ $album->id}}.png ?

  2. Your Album model looks wrong

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement