繁体   English   中英

使用php + Imagick获取缩略图pdf

[英]Get thumbnail pdf with php + Imagick

<?php 
    $dir_pdf = "http://example.com/test/uploads/test_file.pdf";
    $dir_thumbnail = "http://example.com/test/uploads/test_file.jpg"
    $im = new Imagick();
    $im->readImage($dir_pdf);
    header("Content-Type: image/" . $im->getImageFormat());
    echo $im;
?>

在文件夹“上传”中,我有一个pdf文件
我的服务器安装了Imagick&Ghostscript
为什么此代码无法运行:)谢谢。

<?php
    $im = new Imagick("uploads/test_file.pdf[0]");
    $im->setImageFormat("jpg");
    $type=$im->getFormat();
    header("Content-type: $type");
    echo $im->getimageblob();
?>

这是我的代码:)
我将test_file.pdf放在文件夹上传中
它可以工作^^!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM