php-imagine / Imagine

PHP Object Oriented image manipulation library
https://imagine.readthedocs.io
Other
4.41k stars 531 forks source link

Support for pdf, tif, jp2, webp #501

Open asajedi opened 8 years ago

asajedi commented 8 years ago

Hi, is it possible to add support for the following formats:

in lib/Imagine/Imagick/Image.php

private function getMimeType($format)
{
    static $mimeTypes = array(
        'jpeg' => 'image/jpeg',
        'jpg'  => 'image/jpeg',
        'gif'  => 'image/gif',
        'png'  => 'image/png',
        'wbmp' => 'image/vnd.wap.wbmp',
        'xbm'  => 'image/xbm',
    );

    if (!isset($mimeTypes[$format])) {
        throw new RuntimeException(sprintf('Unsupported format given. Only %s are supported, %s given', implode(", ", array_keys($mimeTypes)), $format));
    }

    return $mimeTypes[$format];
}
alexwilson commented 8 years ago

Might be worth adding this into #504 ?

theDyingMountain commented 5 years ago

The Imagine Classes still dont't support webp. E.g. imagecreatefromstring is called, which doesn't support webp see https://github.com/avalanche123/Imagine/blob/develop/src/Gd/Imagine.php#L91

lashus commented 5 years ago

I'm surprised that for 3 years this hasn't been resolved yet :) I've created PR for this - @avalanche123 could you please take a look? It's not a BC.

mlocati commented 5 years ago

I'm surprised that for 3 years this hasn't been resolved yet :)

Maybe you are the first one that needs it and is willing to implement it :wink:

lashus commented 5 years ago

Maybe you are the first one that needs it and is willing to implement it

Don't take me wrong - I wasn't trying to be negative :) Just an observation and clearly the webp format is not as popular as google thinks ^^

jdaury commented 4 years ago

Hi all, are there any plans to support .tif file also?