Search code examples
phplaravelintervention

Image Convert Tiff to png/jpg


How to convert the tiff or tif file convert in png or jpg extension. I used Intervention package for laravel.

When i try to convert tiff to jpg given me error like

ImageMagick module not available with this PHP installation.

Here below is my code

Image::configure(array('driver' => 'imagick'));
$imgCo = Image::make($upload_path.'/original/'.$filename);
$imgCo->save($upload_path.'/print/'.$orgName.'png');

Edited Question ::

I using below path to convert the image

Image::make(/var/www/html/project/public/design/images_directory/original/directory - [12].tif)->encode('png')->save(/var/www/html/projrct/public/design/images_directory/print/directory - [2].png);

Solution

  • Use the encode() method to convert an image and save() to save converted image.

    Image::make('full/path/to/image.tiff')->encode('png')->save('path/to/saved/image.png');
    

    Also, you've just updated the question with the code and the error. To fix the error, you need to install ImageMagick module first.