Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nickf's avatar
Level 5

How to get logo in Cashier invoice template?

I've been having some trouble getting a logo to be displayed in a Cashier PDF invoice generated by dompdf.

I'm able to edit the template file, but the image is displaying as a box with an X through it with the error "Image not found or type unknown". I'm using the full path to the image and I know that it exists at that path.

Having a look at the dompdf documentation, there is an isRemoteEnabled variable that some people seem to have had success overriding to allow images to render but I'm not sure what the best way to override that in a Laravel project is.

Any suggestions would be appreciated. Thanks!

0 likes
10 replies
EventFellows's avatar

can you show your code. we did not have any trouble using a logo on the spark invoice at all (which is cashier under the hood)

nickf's avatar
Level 5

In receipt.blade.php:

<img src="{{ public_path(setting('site_logo')) }}" />

setting('site_logo') returns 'images/logo.png' as a string.

The project is currently on Spark 3.0.5, but I'm in the process of upgrading to 4.0 as well.

Thanks!

EventFellows's avatar

Try to hardcode your image url and see if that works.

If so, check that your {{ public_path(setting('site_logo')) }} returns the exact same string.

One of the two will probably reveal where your issue is.

Neneil35's avatar

Hey guys, neither hardcoded path to file nor hardcoded url to file works. I've tested on my production instance and local...

Do I need a specific file and maybe size?? I am using a png file (also tested with jpg).

jlrdw's avatar

Use asset helper. You don't display an image via a path, it's a url.

Just example:

<img src="{{ asset('public/img/imgdogs/abbie173.jpg') }}" alt="">

Adjust to your image.

olivM's avatar

here is the trick i use :

<img src="file://{{ public_path('images/logo.png') }}" alt="{{ $vendor }}" width="150">
1 like
MrMooky's avatar

This won't work on a production server, or will it? o_O

PeterGreat's avatar

I'm facing the same issue. Trying to display image with full url which is correct but it complains that image not found. Is there a special setting I need to enable the images?

IrishDev's avatar

Publish Cashier views Base64 the logo and insert into receipt blade template

1 like
thang12l's avatar

I used the following code and it worked.

<img width="153" src='data:image/png;base64, {{ base64_encode(file_get_contents(public_path('/assets/logos/logo.png'))) }}' alt="Logo" />

Please or to participate in this conversation.