Get path from storage directory in vue component

Published 10 months ago by xsigns

I need to get the path from /storage/app/public for a image in a .vue component, while using vue-loader.

<img :src="'/storage/app/public' + user.imageFromDb" /> If I go that way, I can't get the image path. But if I try to get an image path from /public/img, it will work like a charme.

I want to store all uploads in the /storage directory, and I'm using the laravel Storage::disk('myDisk')->makeDirectory('path/' . $path); method.

Is there a possibility to get the path in a clean way? Maybe something like that

export default {
  data function() {
      imagePath: '/path/to/storage' + this.user.imageFromDb

You can pass the route '/path/to/storage' as a prop to the vue component?

Please sign in or create an account to participate in this conversation.