1
0
mirror of https://github.com/Intervention/image.git synced 2025-02-06 22:00:38 +01:00

tiff support

This commit is contained in:
Jildert Miedema 2014-05-23 13:29:49 +02:00
parent 0598667afb
commit b4496073ac
2 changed files with 29 additions and 0 deletions

View File

@ -69,6 +69,13 @@ abstract class AbstractEncoder
$this->result = $this->processJpeg();
break;
case 'tiff':
case 'image/tiff':
if (method_exists($this, 'processTiff')) {
$this->result = $this->processTiff();
break;
}
//fall through
default:
throw new \Intervention\Image\Exception\NotSupportedException(
"Writing format ({$format}) is not supported."

View File

@ -65,4 +65,26 @@ class Encoder extends \Intervention\Image\AbstractEncoder
return (string) $imagick;
}
/**
* Processes and returns encoded image as TIFF string
*
* @return string
*/
protected function processTiff()
{
$format = 'tiff';
$compression = \Imagick::COMPRESSION_UNDEFINED;
$imagick = $this->image->getCore();
$imagick->setFormat($format);
$imagick->setImageFormat($format);
$imagick->setCompression($compression);
$imagick->setImageCompression($compression);
$imagick->setCompressionQuality($this->quality);
$imagick->setImageCompressionQuality($this->quality);
return (string) $imagick;
}
}