簡體   English   中英

imagemagick pdf沒有轉換成圖像

[英]imagemagick pdf is not converting into a image

<?php 
class Pdf_to_img extends CI_Controller{
public function converter(){
$this->load->library('image_lib');
$config = array(
    'image_library' => 'imagemagick',
    'library_path' => 'D:\Program Files\ImageMagick-6.9.3-Q16',
    'source_image' => 'theme/assets/pdf/ci.pdf' ,
    'new_image' => 'theme/assets/img/copy.jpg' ,
    'maintain_ratio' => true,
    'width' => 980,
    'quality' => '90%',
   );

   $this->image_lib->initialize( $config );

   if ( $this->image_lib->resize( ) ) {
    $this->image_lib->clear( );
   }
 }
 }
 ?>

朋友,因為我是Codeigniter的新手,所以我在網上沖浪時將pdf文件轉換為圖像,我已經獲得了這段代碼,但是我改變了所有位置,但是在執行時我收到的錯誤信息是

圖像的路徑不正確。 圖像處理失敗。 請確認您的服務器支持所選協議,並且圖像庫的路徑正確。

因此,如果有任何錯誤或要添加的任何代碼來進行更改,請更正我的代碼

我已經在D:\\ Program Files \\ ImageMagick-6.9.3-Q16上安裝了ImageMagick

並且source_image路徑為D:\\ wamp \\ www \\ login \\ theme \\ assets \\ pdf

且新圖像路徑為D:\\ wamp \\ www \\ login \\ theme \\ assets \\ img

請驗證是否首先安裝了imagickphp庫。 然后使用以下命令:

$imagick = new Imagick();
$imagick->readImage('mytest.pdf');
$imagick->writeImage('output.jpg');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM