brand logo not showing
Hello, I am trying to customize the branding of my filamentphp as according to the docs.
My logo is in public/images/logo.png
This is the image tag i'm using:
<img src="{{ asset('/images/logo.png') }}" class="h-10">
I added the symbolic link via this command:
php artisan storage:link
But my logo is not showing on my page as the image can't be found
66 Replies
show us what's in your /public directory
Sorry for being slow, I've been dealing with some family issues, but here it is
So where is logo.png
its not in the images directory
It's the sublime_car.png, I changed the name initially not to give away details of my client
<img src="{{ asset('/images/sublime_car.png') }}" class="h-10">
Since I leaked it that's the exact line of code, I'll remove it later on
can you show me the error in console then?
It's saying the file can't be found
Here is my filesystems.php file
The rest of my filesystems.php file:
is the URL for the file that is in the console error correct?
is your APP_URL correct?
The app_url is correct as it points to my localhost
But if i click on the URL for the file it doesn't find the image
can you spot what is wrong with the url?
There must be a mismatch in my routing i think
http://localhost:8000/images/sublime_car.png As this is the URL it generates, which to me it would appear as it looks in the wrong folder
it looks like the right folder to me
what should it be?
Hm It should be the public folder
hm no
the public directory is the root of the domain
Yes it is
so whats the problem?
The logo isn't displaying on my page:
If i go to /public/images/sublime_car.png i have the same issue
the URL looks right
public should not be in the URL if your server is configured right
i dont know what the problem is, sorry.
this is a laravel issue, not filament
That's alright, thank you for trying to help
Could you point me to some resources I could check out to resolve this issue?
if i knew what the problem was, i would. sorry
That's alright thank you for your help
<img src="/images/logo.png" class="h-10"> try like this, It's working for me
and create a
resources/views/vendor/filament/components/brand.blade.php
fileThose are the steps i followed, but I’m running laravel in a docker with nginx and my problem should be there somewhere
what is the url of the app? Did you set the APP_URL in the .env file?
As I thought the problem was in my nginx.conf file. I managed to fix it by adding the public folder to the location in the conf file.
But now I have this:
Is there a way to center the logo?
Thank you!
In case there's other people here facing similar issues when using docker with nginx to run laravel, here's the solution that worked for me:
Open your nginx.conf file and in there add these lines of code in your server block:
location /images {
alias /var/www/html/public/images;
access_log off;
expires max;
}
location /storage {
alias /var/www/html/storage/app/public;
access_log off;
expires max;
}
or use laravel sail 😅
What is laravel sail?
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Is that like a prebuilt docker image for laravel?
Yes, a great starting point for building laravel apps
Is this also to use in production?
As right now I have a docker image and just do docker-compose up -d and docker compose down to start/stop my applications.
I'm also using a redis and mysql db and nginx server in these containers. So is there a lot of difference between these?
In my opinion, for a development environment
What should i do once i go to production?
deploy your app in your server 🤷♂️
you could install a new laravel instance and try sail...
Well yes, but now i use dockers to deploy everything. If i use the dockers from sail and these are for development env, what do i use when i still want to run it in a docker environment on prod?
As dockers keep everything organized a bit nicer imo
I don't know devops, but google can help you
That's alright, thank you for the help
Sounds like a hack to a bad server config. Is your server root pointing to
/public
Yes
This is my entire nginx.conf file
server {
listen 80;
server_name localhost;
root /var/www/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass cli:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~ /.ht {
deny all;
}
location /images {
alias /var/www/html/public/images;
access_log off;
expires max;
}
location /storage {
alias /var/www/html/storage/app/public;
access_log off;
expires max;
}
}
I appreciate all pointers to better practices, I’m not gonna lie there’s quite a few technologies I’m usingnow that I haven’t used before so sometimes troubleshooting is hard
You shouldn’t need that. Did you symlink the storage folder?
php artisan storage:link
?
Okay you did. Still weird.Yeah I did follow the laravel documentation
Why is the root of your app www/public but your asserts are in www/html/public?
That's a good question, I changed it to /var/www/public and it doesn't work anymore
But it should be
/var/www/html/public
, right?I think so, but the strange thing is this:
This is when i open bash in my docker image everything seems to be in /var/www
Then it's weird that the rest of that nginx config works
Yeah as my root states /var/www/public which is where my index is and my folder images
But if i use /var/www/public/images in my conf it doesn't work, i need the html
And if i change my root to /var/www/html/public my application stops working
Do i need to manually create this folder?
resources/views/vendor/filament/components/brand.blade.php file
I created the folder and added the Logo inside public/images/logo.png. but did not work
App name shown there
is there any other configurations to be done?
<img src="{{ asset('/images/logo.png') }}" alt="Logo" class="h-10">
You are not on filament v3, correct?
i'm using filament v3
When i paste this url on browser image is showing http://127.0.0.1:8001/images/logo.svg
Then the file needs to be logo.blade.php instead of brand.blade.php
not working mate 🥹
Check the directory structure
On v3 is filament-panels
resources/views/vendor/filament-panels/components/logo.blade.php
Wow mate thanks. it's worked. btw what is the different between brand logo and logo?
Just the naming used on v2 vs v3
this whole time i refer v2 doc. thanks for saving me @rg.block 😅