简体   繁体   中英

Yii create PDF Thumbnail with ImageMagick

如果我上载PDF,我想创建自动缩略图,然后我将保存该路径,并使用yii框架构建网站,并尝试使用ImageMagick Any Body Help..Thx进行捕获。

I am also using Yii framework to generate the image file. It is pretty simple and straight forward. I am using window XP/apache and php 5.4

  1. Download and install the imagemagick http://www.imagemagick.org/script/download.php
  2. Download and install php extension for imagemagic http://pecl.php.net/package/imagick
  3. Download and install the ghostscript because image magic use the ghost script to convert the pdf to images http://www.ghostscript.com/download/
  4. Write a method in your model class to handle conversion

    use command : command format OR

    use library : php manual

  5. Call the method after your form submission.

check if the image is saved at the desired location. I hope that help. Let me know if you face any issue.

I know you asked about ImageMagick but maybe you could use GD instead to accomplish such simple operation. It's available virtually on every hosting.

Examples in comments below docs.

http://php.net/manual/en/book.image.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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