Skip to content

Resizing does not seem to work on clean install #611

@appdezign

Description

@appdezign

Filament Version

v3.3.20

Plugin Version

v3.7

PHP Version

PHP 8.2.28

Problem description

I have added the Curator plugin to a clean install of Laravel 11, Filament 3.3, and Cropper.js v1.6.2.

I have followed the installation instructions to the letter, and the plugin seems to work fine.
But when I try to resize large images on upload (using imageCropAspectRatio, imageResizeMode, imageResizeTargetWidth, imageResizeTargetHeight) I still get the original file on disk. No resizing occurs.

 CuratorPicker::make('curator_featured')
                    ->imageCropAspectRatio('16:9')
                    ->imageResizeMode('cover')
                    ->imageResizeTargetWidth('1920')
                    ->imageResizeTargetHeight('1080'),

When I use the default FileUpload Component with the same settings, the same image is resized correctly.

FileUpload::make('filament_featured')
                    ->imageCropAspectRatio('16:9')
                    ->imageResizeMode('cover')
                    ->imageResizeTargetWidth('1920')
                    ->imageResizeTargetHeight('1080'),

When I compare the x-data on the fileUploadFormComponent in my inspector (after opening the modal), the CuratorPicker shows:

x-data="fileUploadFormComponent({
    ...
    imageCropAspectRatio: null,
    imagePreviewHeight: null,
    imageResizeMode: null,
    imageResizeTargetHeight: null,
    imageResizeTargetWidth: null,
    imageResizeUpscale: true,
    ...
})"

and the default FileUpload shows:

x-data="fileUploadFormComponent({
    ...
    imageCropAspectRatio: '16:9',
    imagePreviewHeight: null,
    imageResizeMode: 'cover',
    imageResizeTargetHeight: '1080',
    imageResizeTargetWidth: '1920',
    imageResizeUpscale: true,
    ...
})"

The console does not show any errors.

This would explain why the CuratorPicker does not resize my uploads, but it also means that the settings that I'm passing with the CuratorPicker component are not passed through when the modal is opened.

Expected behavior

The expected behaviour is that the the settings that I'm passing with the CuratorPicker component are passed through when the modal is opened, and that my uploads are resized correctly.

Steps to reproduce

Clean install of Laravel 11, Filament 3.3, Curator v3.7 on PHP 8.2.
Add CuratorPicker to resource, with the resize options mentioned

Reproduction repository

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions