bionary
bionary
FFilament
Created by bionary on 6/26/2024 in #❓┊help
Anybody find a decent solution for table images to a lightbox?
@_andypeacock Your solution looks a lot smarter/cleaner than what I came up with. Thank you. I was doing something similar but packing it all in the Filament Resource like this:
SpatieMediaLibraryImageColumn::make($dotNotationMediaPath)
->action(
Actions\Action::make($dotNotationMediaPath)
->modalHeading(false)
->extraModalWindowAttributes(['class'=>'justify-center h-[calc(100vh-100px)]', 'style'=>'flex-direction:inherit'])
->modalContent(function($record){
$imageUrl = $record?->getFirstMedia($collection)?->getUrl('preview');
return new HtmlString("<img src='$imageUrl' class='object-scale-down max-h-full p-4'>");
})
->modalFooterActions(fn() => [])
SpatieMediaLibraryImageColumn::make($dotNotationMediaPath)
->action(
Actions\Action::make($dotNotationMediaPath)
->modalHeading(false)
->extraModalWindowAttributes(['class'=>'justify-center h-[calc(100vh-100px)]', 'style'=>'flex-direction:inherit'])
->modalContent(function($record){
$imageUrl = $record?->getFirstMedia($collection)?->getUrl('preview');
return new HtmlString("<img src='$imageUrl' class='object-scale-down max-h-full p-4'>");
})
->modalFooterActions(fn() => [])
I never quite found a way to scale the image properly. Even with my custom class added to the image, it was still not scaling properly and would get cut off if the aspect ratio was extreme. Also the white border around the image was never equal/balanced...but my tailwind skills are junk. Can't wait to try your solution, thanks!
10 replies
FFilament
Created by bionary on 8/21/2024 in #❓┊help
Show First image: SpatieMediaLibraryImageColumn
thank you
15 replies
FFilament
Created by bionary on 8/21/2024 in #❓┊help
Show First image: SpatieMediaLibraryImageColumn
Since all I need is the first image (luckily) I'm all good with ->limit(1) for now
15 replies
FFilament
Created by bionary on 8/21/2024 in #❓┊help
Show First image: SpatieMediaLibraryImageColumn
indeed.
15 replies
FFilament
Created by bionary on 8/21/2024 in #❓┊help
Show First image: SpatieMediaLibraryImageColumn
I was thinking I could get clever and use field: collection_name to isolate an image...but that feels a bit hacky to me.
15 replies
FFilament
Created by bionary on 8/21/2024 in #❓┊help
Show First image: SpatieMediaLibraryImageColumn
As in pick a different image based on some values I have stored in the custom_properties field of the table.
15 replies
FFilament
Created by bionary on 8/21/2024 in #❓┊help
Show First image: SpatieMediaLibraryImageColumn
Is there a reason ->getStateUsing() doesn't work? in my case I'm all good...for now, but what if I wanted to get a bit more choosy with which image shows...
15 replies
FFilament
Created by bionary on 8/21/2024 in #❓┊help
Show First image: SpatieMediaLibraryImageColumn
It works perfectly, thanks
15 replies
FFilament
Created by bionary on 8/21/2024 in #❓┊help
Show First image: SpatieMediaLibraryImageColumn
just found that!
15 replies
FFilament
Created by bionary on 7/15/2024 in #❓┊help
Spatie Media Library Conversion Quality NOT Applied
I'll post a bug at Spaties Github
11 replies
FFilament
Created by bionary on 7/15/2024 in #❓┊help
Spatie Media Library Conversion Quality NOT Applied
Roger that.
11 replies
FFilament
Created by bionary on 7/15/2024 in #❓┊help
Spatie Media Library Conversion Quality NOT Applied
@awcodes Adam, I was going to file a bug at https://github.com/filamentphp/spatie-laravel-media-library-plugin but it is READ ONLY.
11 replies
FFilament
Created by bionary on 7/15/2024 in #❓┊help
Spatie Media Library Conversion Quality NOT Applied
fyi: there was talk about a related bug here: https://github.com/spatie/laravel-medialibrary/issues/3502
11 replies
FFilament
Created by bionary on 7/15/2024 in #❓┊help
Spatie Media Library Conversion Quality NOT Applied
The simplified version looks like this:
public function handle(ConversionHasBeenCompletedEvent $event): void
{
$media = $event->media;

if($media->mime_type == 'image/png'){

$conversionName = $event->conversion->getName();

//Replace with compressed version
$image = Image::load($media->getPath($event->conversion->getName()))
->quality(65)
->optimize()
->save();
}
}
public function handle(ConversionHasBeenCompletedEvent $event): void
{
$media = $event->media;

if($media->mime_type == 'image/png'){

$conversionName = $event->conversion->getName();

//Replace with compressed version
$image = Image::load($media->getPath($event->conversion->getName()))
->quality(65)
->optimize()
->save();
}
}
11 replies
FFilament
Created by bionary on 7/15/2024 in #❓┊help
Spatie Media Library Conversion Quality NOT Applied
For now I created a janky work around. I added a Spatie ConversionHasBeenCompletedEvent listener. From there I re-create each conversion with proper jpeg compression
11 replies
FFilament
Created by bionary on 7/15/2024 in #❓┊help
Spatie Media Library Conversion Quality NOT Applied
I upgraded my imagemagick in brew just now...still same error
11 replies
FFilament
Created by bionary on 7/13/2024 in #❓┊help
Spatie Media Library breaks with ->disabled()
Still broken
9 replies
FFilament
Created by bionary on 7/13/2024 in #❓┊help
Spatie Media Library breaks with ->disabled()
So yes ->disabled() breaks the media library
9 replies
FFilament
Created by bionary on 7/13/2024 in #❓┊help
Spatie Media Library breaks with ->disabled()
yes: Spatie Media Library breaks with ->disabled()
9 replies
FFilament
Created by bionary on 7/13/2024 in #❓┊help
Spatie Media Library breaks with ->disabled()
Thanks for testing it out. I still get the error. btw: I think the make('value') is just a unique identifier to help the internals keep track of the form fields. I don't think changing this has any affect. When I originally got this error, I upgraded: composer update filament/spatie-laravel-media-library-plugin but even after this I still get the error
9 replies