0

Hi friends,

In one of my project I want to convert tiff files to png/jpg using php for making a film strip. So if there is any way for doing that ....

Please help me
thanks in advance
Rajeesh

5
Contributors
4
Replies
13
Views
6 Years
Discussion Span
Last Post by monika1992
1

From the php manual, comments section:

"If you want to convert from TIFF to JPG you can use ImageMagick if it is installed in your server."

<?php
$exec = 'convert /path/to/file.tiff /path/to/file.jpg 2>&1';
@exec($exec, $exec_output, $exec_retval);

//possible error
print_r($exec_output)
?>
0
<?php
try
{
  // Saving every page of a TIFF separately as a JPG thumbnail
  $images = new Imagick("testing.tif");
  foreach($images as $i=>$image) {
    // Providing 0 forces thumbnail Image to maintain aspect ratio
    $image->thumbnailImage(768,0);
    $image->writeImage("page".$i.".jpg");
    echo "<img src='page$i.jpg' alt='images' ></img>";
  }
  $images->clear();
}
catch(Exception $e)
{
  echo $e->getMessage();
}
?>

Edited by Ezzaral: Snipped promtional link. No advertising please.

0

no way in native php but you can use any script/executable in php as demonstrated above. Note, you must be careful in using methods as above especially if command can be called from outside the script. It might well be a bomb against your own app!

0

Hi there

I am using imagemagick for image formate conversion but i am getting fatal error for Imagick class not found.

Are you able to do this conversion with latest version ??

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.