Skip to content

Docker caveat #538

@kl3sk

Description

@kl3sk

Question and answer

Hello, I faced the problem with loading image as seen in this issue.
All fixes were made without any success. But after a repairing night, the solution come to me, so I would like to share it with you.

I've read lot of issues here and on DomPDF repo as well.
I saw on the DomPDF options that ext_curl or allow_url_fopen should be enabled, so images where not loaded directly by the web server but by the PHP engine.

And because I'm using docker with to separate container it could nerver work.

This couldn't be fix on the package but a notice can be set.

Using docker-compose on {{ absolute_url(asset( <image path> )) }} I just replace the host (localhost in my case) with the "linked" container name (web in my case).

A simple {{ absolute_url(asset( <image path> ))|replace({'localhost': 'web'}) }} fix my problem.

In fact this solution should be per project, I personally create a Twig extension that replace it only on Dev env.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions