Skip to content

Avatar failed to upload after crop #1060

@Dennise89

Description

@Dennise89

maryUI version

2.7.1

daisyUI version

not applicable

Livewire version

4.0.1

What browsers are affected?

Chrome

What happened?

PHP

    public array $config = ['aspectRatio' => 1];
    public ?TemporaryUploadedFile $avatar = null;

HTML/Blade

<x-file
        wire:model="avatar"
        accept="image/*"
        crop-after-change
        :label="__('Profile picture')"
        :change-text="__('Change')"
        :crop-text="__('Crop')"
        :crop-title-text="__('Crop image')"
        :crop-cancel-text="__('Cancel')"
        :crop-save-text="__('Crop')"
        :crop-config="$config"
    >
        <x-avatar
            class="w-30 ring-4 ring-yellow-400/30"
            :image="auth()->user()->avatar_url
            ? Storage::url(auth()->user()->avatar_url)
            : null"
            :placeholder="auth()->user()->initials()"
        />
    </x-file>

When I upload the image, I can crop it and aspect ratio is good. When I click the button "Crop" it gives the following error: "The avatar failed to upload.". After saving, the image is the image I uploaded, but not the cropped variant. It just crops the middle of the image. And not the part of the image I selected within the popup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions