#Problems at viewing icons on the frontend with Vue3

1 messages · Page 1 of 1 (latest)

violet kestrel
#

I'm trying to view this icon:

    <img src="/home/pc/whistler/resources/bi/bootstrap.svg" alt="Bootstrap" width="32" height="32">

But the result is this:

#

Problems at viewing icons on the frontend with Vue3

#

I've tested the same code on a vanilla vue3 app, the icon appeared successfully,
Thus I concluded that this must be a problem related to laravel

dapper wolf
#

What is this path? I'm 99% sure it's wrong

violet kestrel
dapper wolf
#

/home/pc what is this? it can't be right

violet kestrel
dapper wolf
#

so?

#

path needs to start from project root not your os

#

don't know you are using vue or inertia

#

imagine you deploy your app and on your server user won't be pc

#

then your path /home/pc automatically will be wrong

#

then what? you will change for every asset path? what if you 100+ files?

violet kestrel
#

it didn't show the picture even when the absolute path was defined as a path

dapper wolf
#

are you using plain vue or vue with inertia?

violet kestrel
#

vue with inertia

dapper wolf
#

okay, then where do you store your images?

violet kestrel
#

at /home/pc/whistler/resources/bi

dapper wolf
#

forget /home/pc

#

First read docs on the filesystem

violet kestrel
#

@dapper wolf I don't get it, how is this related to my problem?
I didn't even touch my php code yet and everything so far is on the frontend

dapper wolf
#

check where you need to store files

#

so that you could access them via url

violet kestrel
#

I don't want to access the pictures via the url, I just want to make them visible in as a content in the front page and make it work as a normal frontend app

dapper wolf
#

it's the same as accessing them via url

#

so you need to put everything in the public directory

night dome
#

You need to use a relative path, or use the alias. If you use the alias it would be something like @/bi/bootstrap.svg, then Vite will process the file and add it to your build automatically

dapper wolf
#

but still the path wont be /home/pc/whatever...