Skip to content

Commit

Permalink
fix webp unsupported form bug
Browse files Browse the repository at this point in the history
  • Loading branch information
antonlukin committed Feb 8, 2024
1 parent 1e0b7e2 commit d8e6bfe
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 17 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antonlukin/poster-editor",
"version": "5.10",
"version": "5.11",
"description": "Wrapper for PHP's GD Library for easy image manipulation",
"keywords": ["php", "image", "text", "gd"],
"homepage": "https://github.com/antonlukin/poster-editor",
Expand Down
53 changes: 38 additions & 15 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added example/images/belgrade.webp
Binary file not shown.
22 changes: 22 additions & 0 deletions example/webp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* WebP support example.
* php version 7.1
*
* @category PHP
* @package PosterEditor
* @author Anton Lukin <[email protected]>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterEditor\PosterEditor();
$image->make('images/belgrade.webp')->fit(1000, 400)->blackout(50);
$image->show();

} catch(Exception $e) {
echo $e->getMessage();
}
3 changes: 2 additions & 1 deletion src/PosterEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @package PosterEditor
* @author Anton Lukin <[email protected]>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @version Release: 5.10
* @version Release: 5.11
* @link https://github.com/antonlukin/poster-editor
*/
class PosterEditor
Expand Down Expand Up @@ -1138,6 +1138,7 @@ protected function getSource($file, $type)

case IMAGETYPE_WEBP:
$source = imagecreatefromwebp($file);
break;

default:
return $this->handleError('Unsupported image type');
Expand Down

0 comments on commit d8e6bfe

Please sign in to comment.