php Laravel DomPDF以PDF格式显示图像

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Laravel DomPDF以PDF格式显示图像相关的知识,希望对你有一定的参考价值。

<img class="image-uploaded center img-responsive" src="{{ public_path($office_photo['storage_path']) }}">

<img src="{{ public_path("storage/images/".$user->profile_pic) }}" alt="" style="width: 150px; height: 150px;">
    private function getAttachedMedia($model, $collection_name='')
    {
        $uploaded_media = [];

        if (empty($collection_name)) {
            $uploaded_files = $model->getMedia();
        }
        else {
            $uploaded_files = $model->getMedia($collection_name);
        }

        if ($uploaded_files->count()) {

            foreach ($uploaded_files as $file) {

                $uploaded_media[] = [
                    'id' => $file->id,
                    'name' => $file->name,
                    'mime_type' => $file->mime_type,
                    'url' => $file->getFullUrl(),
                    'storage_path' => $file->getUrl(),
                    'full_path' => $file->getPath(),
                ];
            }
        }

        return $uploaded_media;
    }

以上是关于php Laravel DomPDF以PDF格式显示图像的主要内容,如果未能解决你的问题,请参考以下文章

Dompdf-Laravel Unicode 字符无法正确呈现

Laravel Dompdf 生成 pdf 错误

Laravel:尝试获取 PDF 时出现 DOMPDF 错误

laravel中使用的PDF扩展包——laravel-dompdf和laravel-snappy

文本对齐:通过 DomPDF (Laravel) 生成 PDF 居中,向右偏移一点

barryvdh/laravel-dompdf 分页符内容更改 PDF