[Vuejs]-Vue.js: show profile image in laravel public folder

0👍

If your database column name for the image file is img then
you can do it like below:

<div class="user" v-if="comment.user.img">
    <img :src="'uploads/profile/'+comment.user.img">
</div>
<div class="user" else>
    <img :src="default_image_path_here">
</div>

If you are using multiple images for a user you need to add a loop as follow:

<div class="user" v-if="comment.user.img.length > 0">
    <span v-for="(item, index) in comment.user.img">
         <img :src="'uploads/profile/'+item.your_image_name_column">
    </span>
</div>
<div class="user" else>
    <img :src="default_image_path_here">
</div>

Leave a comment