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

Recommended Answers

All 4 Replies

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)
?>
<?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();
}
?>

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!

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 ??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.