<?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( );
}
}
}
?>
Friends as i'm new to codeigniter , i'm converting a pdf file into image while surfing i've got this piece of code i've altered all the location but while executing i'm recieving the error as
The path to the image is not correct. Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct.
So please correct my code if there is any error or any code to be added to make the change
I've installed the ImageMagick ON D:\Program Files\ImageMagick-6.9.3-Q16
and source_image path is D:\wamp\www\login\theme\assets\pdf
and new image path is D:\wamp\www\login\theme\assets\img
Please verify that the imagickphp library is installed first. Then uses the following commands:
$imagick = new Imagick();
$imagick->readImage('mytest.pdf');
$imagick->writeImage('output.jpg');