Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image: add support for webp #73

Closed
wants to merge 1 commit into from
Closed

Image: add support for webp #73

wants to merge 1 commit into from

Conversation

@enumag
Copy link
Contributor

enumag commented Aug 3, 2015

Not sure how to write tests - there aren't any tests specific for the other types either.

Also should I check for php version?

@@ -101,7 +101,8 @@ class Image extends Nette\Object
/** image types */
const JPEG = IMAGETYPE_JPEG,
PNG = IMAGETYPE_PNG,
GIF = IMAGETYPE_GIF;
GIF = IMAGETYPE_GIF,
WEBP = -1;

This comment has been minimized.

Copy link
@enumag

enumag Aug 3, 2015

Author Contributor

Similar constant for webp does not exist (yet).

throw new Nette\InvalidArgumentException("Unsupported image type '$type'.");
}
header('Content-Type: ' . image_type_to_mime_type($type));
header('Content-Type: ' . ($type === self::WEBP ? 'image/webp' : image_type_to_mime_type($type)));

This comment has been minimized.

Copy link
@enumag

enumag Aug 3, 2015

Author Contributor

Webp is not supported by image_type_to_mime_type.

@dg

This comment has been minimized.

Copy link
Member

dg commented Aug 3, 2015

Does getimagesizefromstring support WEBP?

@enumag

This comment has been minimized.

Copy link
Contributor Author

enumag commented Aug 3, 2015

Oh boy of course it does not. :-(

@enumag enumag force-pushed the enumag:webp branch from 1b0078c to c545d24 Aug 3, 2015
@enumag

This comment has been minimized.

Copy link
Contributor Author

enumag commented Aug 3, 2015

There is no way to detect webp images in fromString and fromFile (aside from checking file extension in fromFile) so I removed webp from both. But I still think Nette\Utils\Image should be able to generate webp images.

@dg

This comment has been minimized.

Copy link
Member

dg commented Aug 3, 2015

It is possible via $image->webp('file.webp'); Full support is currently IMHO not possible.

@enumag

This comment has been minimized.

Copy link
Contributor Author

enumag commented Aug 3, 2015

Ok, closing for now. Thank you.

@enumag enumag closed this Aug 3, 2015
@enumag

This comment has been minimized.

Copy link
Contributor Author

enumag commented Oct 8, 2016

Webp support has been added for PHP 7.1RC4. It should be possible to implement this now.

@enumag enumag reopened this Oct 8, 2016
@dg dg closed this in 98717f3 Dec 19, 2016
dg added a commit that referenced this pull request Dec 19, 2016
dg added a commit that referenced this pull request Dec 19, 2016
dg added a commit that referenced this pull request Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.