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

If extension is in uppercase, still assign the correct type to it #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Formats/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function make(string $column = ''): static

final public function __construct(protected string $column = '')
{
$this->manipulations = new Manipulations();
$this->manipulations = new Manipulations;
$this->definition();

$this->name = Str::headline(class_basename(static::class));
Expand Down
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
4 changes: 2 additions & 2 deletions src/Providers/MediaLibraryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function packageBooted(): void
$this->registerLivewireComponents();
$this->registerBladeComponents();

UploadedFile::mixin(new UploadedFileMixin());
UploadedFile::mixin(new UploadedFileMixin);
}

protected function registerLivewireComponents()
Expand All @@ -84,7 +84,7 @@ public function packageRegistered(): void
{
parent::packageRegistered();

$this->app->singleton(Formats::class, fn () => new Formats());
$this->app->singleton(Formats::class, fn () => new Formats);

$this->app->bind(Conversion::class, config(
"{$this->packageName()}.conversion",
Expand Down
5 changes: 5 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,17 @@ 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';
}
}