0

I use controllers to load s3 images on my app as below;

                $disk = Storage::disk('s3');
            $s3Client = $disk->getAdapter()->getClient();
            $stream = $s3Client->getObject([
                'Bucket' => \Config::get('filesystems.disks.s3.bucket'),
                'Key' => $filepath
            ]);
            return response($stream['Body'], 200)->withHeaders([
                'Content-Type' => $stream['ContentType'],
                'Content-Length' => $stream['ContentLength'],
                'Content-Disposition' => 'inline; filename="' . $project->logopath . '"',
            ]); 

Then I access the image with below link;

http://127.0.0.1:8000/uploads/1/projectlogo

When I use the URL for img src link, my pages display the images properly. I am happy with the result. It works.

However, I dont have the same result when I try to load images from s3 on my pdf views. (I am able to load locally stored images).

How can I load images from my s3 storage in my pdf views?

Thanks.

eleven0
  • 263
  • 6
  • 13
  • http://127.0.0.1:8000/uploads/1/projectlogo does this work when logged out of application? Do you have any auth checks? – Manpreet Jul 30 '19 at 23:17
  • @Manpreet yes, I do.... Whole application is for only paid customers. That's the issue? How can I go around this to resolve this? – eleven0 Jul 31 '19 at 08:57
  • If you can't access you photo URL when logged out, neither could Wkhtmltopdf – Manpreet Jul 31 '19 at 11:48
  • You can try this: https://stackoverflow.com/questions/11896726/session-issue-in-wkhtmltopdf – Manpreet Jul 31 '19 at 11:50
  • https://stackoverflow.com/questions/15903355/how-to-pass-laravel-session-to-wkhtmlltopdf – Manpreet Jul 31 '19 at 11:52

0 Answers0