Skip to content

Commit

Permalink
Improvement to the detection of the original image's mime type (uses …
Browse files Browse the repository at this point in the history
…less system resources)
  • Loading branch information
Bradie Tilley committed Sep 7, 2020
1 parent 97d8542 commit f0c12d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 3 additions & 5 deletions classes/Resizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use File;
use Intervention\Image\ImageManagerStatic as Image;
use Validator;
use Illuminate\Support\Str;

class Resizer
{
Expand Down Expand Up @@ -690,11 +691,8 @@ private function detectFormat(bool $useNewFormat = false): array
if ($useNewFormat && !empty($this->options['format']) && ($this->options['format'] !== 'auto')) {
$format = $this->options['format'];
} else {
// Get the image resource entity if not already loaded
$this->initResource();

// Get format from image
$format = strtolower(explode('/', $this->original->mime())[1]);
$format = File::mimeType($this->getImagePath());
$format = Str::after($format, '/');
}

// For the most part, the mime is the format: image/{format}
Expand Down
4 changes: 3 additions & 1 deletion updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@
2.1.7:
- Fix - Update plugin's boot method to not directly reference Settings until DB connection is established
2.1.8:
- Added twig filter to parse and resize/modify images (via regex) using twig filter(s)
- Added twig filter to parse and resize/modify images (via regex) using twig filter(s)
2.1.9:
- Improvement to the detection of the original image's mime type (uses less system resources)

0 comments on commit f0c12d5

Please sign in to comment.