gsk*_*gsk 5 php pdf preview laravel laravel-5.1
我有文件模块,我想要列出所有文件,并带有缩略图预览.
如下,
我将文件存储在storage文件夹中,无法访问http.
那么如何为文档提供缩略图预览,尤其是图像和PDF.
laravel 5.1中是否有可用的包装?
PDF文件的预览图像通常是PDF文件的第一页.
您可以使用ImageMagick获取PDF文件的第一页.
<?php
$imagick = new imagick('sample.pdf[0]'); // 0 specifies the first page of the pdf
$imagick->setImageFormat('jpg'); // set the format of the output image
header('Content-Type: image/jpeg'); // set the header for the browser to understand
echo $imagick; // display the image
?>
您还可以输出(将图像内容保存在文件中)并将其存储在缩略图文件夹下,并将PDF名称作为文件名.喜欢(sample.jpg)
至于基于laravel的解决方案,我不认为laravel有任何可以做同样的包