Picker shows medium image : how to override it ? #251
Closed
christopher87
started this conversation in
General
Replies: 1 comment 1 reply
-
You could create a custom Media model and modify the medium image attribute. <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
class Media extends \Awcodes\Curator\Models\Media
{
protected function mediumUrl(): Attribute
{
return Attribute::make(
get: fn () => $this->getSignedUrl(['w' => 1000, 'h' => 260, 'fit' => 'contain', 'fm' => 'webp']),
);
}
} Then from your app service provider tell Curator to use this model - https://github.com/awcodes/filament-curator#global-settings use Awcodes\Curator\Facades\Curator;
public function register()
{
Curator::mediaModel(\App\Models\Media::class);
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am using latest stable version 2.8.5, with Filament 2.
I have uploaded the following image :
![image](https://camo.githubusercontent.com/41aa480c65ec411efd3c67c85af239e1f1bc9586651cb2175eaf9cd779c8d9e7/68747470733a2f2f692e6962622e636f2f3976537473314a2f53637265656e73686f742d323032332d30382d30342d61742d32322d33382d34372e6a7067)
The picker shows a cropped image (format "medium_url") :
With constrained(true) :
![image](https://camo.githubusercontent.com/86aa0abcaead01fb2fc6b082a4ec2e9184f033830fe5312dd1c04adad367fd29/68747470733a2f2f692e6962622e636f2f6d584a54624a512f53637265656e73686f742d323032332d30382d30342d61742d32322d33392d31302e6a7067)
With constrained(false) :
![image](https://camo.githubusercontent.com/743735c082ee41e2dbcdb9c800ca9f80128ffb82ddbac0b25852174fe9357dd9/68747470733a2f2f692e6962622e636f2f78446648505a372f53637265656e73686f742d323032332d30382d30342d61742d32322d33382d35372e6a7067)
But I wish I could display image not cropped.
How can I override this behaviour ?
Thanks in advance,
Beta Was this translation helpful? Give feedback.
All reactions