Skip to content

Commit

Permalink
Small Bug Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
taufik-nurrohman committed Jul 13, 2020
1 parent c8a59d9 commit a03bdc9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Image Extension for Mecha
Release Notes
-------------

### 2.2.5

- Small bug fixes.

### 2.2.4

- Fix encoded data image URL being passed to the `imagecreatefromstring()` without decoding it first.
Expand Down
2 changes: 1 addition & 1 deletion image/about.page
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Image
description: Image resizer and cropper.
author: Taufik Nurrohman
type: Markdown
version: 2.2.4
version: 2.2.5

use:
'.\lot\x\page': 0
Expand Down
13 changes: 11 additions & 2 deletions image/engine/kernel/g-d.image.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,17 @@ public function __construct(string $path = null) {
// Create image from local file
} else if (\is_file($path)) {
$type = \mime_content_type($path);
if (0 === \strpos($type, 'image/') && \function_exists($fn = $from . \pathinfo($path, \PATHINFO_EXTENSION))) {
$blob = \call_user_func($fn, $path);
if (0 === \strpos($type, 'image/')) {
// Try with image type by default
if (\function_exists($fn = $from . \explode('/', $type, 2)[1])) {
$blob = \call_user_func($fn, $path);
}
// Try with image extension if `$blob` is `false`
if (!$blob && \function_exists($fn = $from . \pathinfo($path, \PATHINFO_EXTENSION))) {
$blob = \call_user_func($fn, $path);
}
// Last try?
if (!$blob) {}
}
$this->exist = true;
$this->path = $path;
Expand Down

0 comments on commit a03bdc9

Please sign in to comment.