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

Ability to resize canvas when keeping fill background a certain color #249

Merged
merged 7 commits into from
May 17, 2024

Conversation

OzanKurt
Copy link
Contributor

Before:

    public function registerMediaConversions(BaseMedia $media = null): void
    {
        $this->addMediaConversion('avatar-minified')
            // It's not possible to define a background color.
            ->fit(Fit::Fill, 320, 320)
            ->performOnCollections('avatar');
    }
    public function registerMediaConversions(BaseMedia $media = null): void
    {
        $this->addMediaConversion('avatar-minified')
            // We can now specify the background color we want
            ->fit(Fit::Fill, 320, 320, false, $media?->custom_properties['background'] ?? '000000')
            ->performOnCollections('avatar');
    }

Before:
image

After:
image

@freekmurze
Copy link
Member

It seems like the tests are failing. Could you have a look?

@OzanKurt
Copy link
Contributor Author

I will be fixing tests today, thanks!

@timvandijck timvandijck merged commit 392385f into spatie:main May 17, 2024
3 checks passed
@timvandijck
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants