Search code examples
phplaravelwkhtmltopdf

wkhtmltopdf export pdf with image doesnt work, image look linke not found


Image dump

When i trying to export pdf with image - and use dump(dd) i can see my image, but when export them i have this problem image doesnt render

What i need to do? may be i don't have required module on server? or i need change my html?

@if(isset($photo) && count($photo) > 0)
    <div style="margin-top: 30px;">
        @foreach($photo as $image)
        <img height="200" width="200" src="{{$image}}">x
        @endforeach
    </div>
@endif

Solution

  • It doesn't find the images. I'm not too familiar with Laravel, but one of these should work:

    • Relative path /img/file.jpg
    • Path as you'd enter in the browser https://example.com/img/file.jpg
    • Path as you'd enter in the command line /var/www/img/file.jpg or C:\www\img\file.jpg on Windows

    I forget which one it needs, but try all three and I'm sure one of them will work.