lundi 21 mai 2018

Laravel - Generating PDF With Dynamic Image from Storage Stalls

I have an issue with a view and generated content to produce a PDF. At the moment, I've been working with niklasravnsborg\LaravelPdf (a wrapper for mPDF, because of an issue with another PDF writer I was working with beforehand), which turns out nice PDFs that are of the quality that I want.

I have never had an issue with images inside of the view before with this PDF writer though, but I must admit that they were with images that had been set-up inside the view already (like a logo, rather than say an employees photo).

My issue arises in a way that has at least allowed me to track down the issue a little better.

From my controller, I get the following:

$employeeMedCert = $employee->attachments()->where('category','Medical Examiners Certificate')->orderBy('endDate','desc')->limit(1)->get();

And then in my blade I have the following:

@foreach($employeeMedCert as $med){ @enforeach

Now, with this current setup, I get the public path of the attachment, without any issue at all.

HOWEVER, if I do the following:

@foreach($employeeMedCert as $med){ <img src=""> @enforeach

It stalls my Laravel to a point where I have to reset the server and hasn't generated anything.

I'm not sure what the issue is, like I said, I've had no issues with images before and the images I am referencing dynamically aren't large by any means (300 - 600 kB), so I am not sure where the issue actually is.

Thanks for the help in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire