Skip to content

Commit

Permalink
If extension is in uppercase, still assign the correct type to it. re…
Browse files Browse the repository at this point in the history
…fs #FIL001-140
  • Loading branch information
jyrkidn committed Aug 26, 2024
1 parent 6f2bbb0 commit 74044d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Mixins/UploadedFileMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function fileType()
{
return function (): string {
foreach (config('filament-media-library.extensions', []) as $type => $extensions) {
if (in_array($this->getClientOriginalExtension(), $extensions)) {
if (in_array(Str::lower($this->getClientOriginalExtension()), $extensions)) {
return $type;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Codedor\MediaLibrary\Facades\Formats;
use Illuminate\Support\Str;

if (! function_exists('get_placeholder_url_by_format')) {
function get_placeholder_url_by_format($format)
Expand All @@ -18,13 +19,15 @@ function get_placeholder_url_by_format($format)
if (! function_exists('is_convertible_image')) {
function is_convertible_image(string $extension): bool
{
$extension = Str::lower($extension);
return in_array($extension, config('filament-media-library.extensions.image', [])) && $extension !== 'gif' && $extension !== 'svg';
}
}

if (! function_exists('is_image_with_dimensions')) {
function is_image_with_dimensions(string $extension): bool
{
$extension = Str::lower($extension);
return in_array($extension, config('filament-media-library.extensions.image', [])) && $extension !== 'svg';
}
}

0 comments on commit 74044d4

Please sign in to comment.