How can I use an generated image link in Dompdf?

When I put this link into my browser an image is downloaded:

http://localost:8888/manager/images/download/526

When I am using the link on my page.html.twig Template like this:

<img src="http://localost:8888/manager/images/download/526" alt="image"/>

Then I see an image.

But if I use the same image link on my dompdf template I always get the message:

image not found or type unknown

I didn’t find a solution yet to make this work.

(It also does not work when I create a link that ends with jpg.)

I tried to add this code

  public function setRemoteOption()  {
       $this->options->setIsRemoteEnabled(true);
       $this->pdf->setOptions($this->options);
   }

And also this:

  $contxt = stream_context_create([
      'ssl' => [
        'verify_peer' => FALSE,
        'verify_peer_name' => FALSE,
        'allow_self_signed'=> TRUE
      ]
    ]);

    $dompdf->setHttpContext($contxt);

But it did not solve the problem

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *