用php + Imagick获取缩略图pdf
<?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;
?>

In folder "uploads" i have a pdf file
My server installed Imagick & Ghostscript
Why this code can't run :) Thank you .

1个回答

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

this is my code :)
I put test_file.pdf in folder uploads
it work ^^!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐