open-admin icon indicating copy to clipboard operation
open-admin copied to clipboard

Thumbnail generation stops working when ->pick() is added to image upload field.

Open bytebrain opened this issue 1 year ago • 1 comments

I've added the pick() method to my image upload field, but then the thumbnail generation is not called. No errors/exceptions, it is just omitted. When I remove the pick() method, the thumbnail generation is working again. I've tried all different methods for generating thumbnails, but they all have the same problem. It happens with single and multiple image uploads.

$form->multipleImage('images', __('admin.images'))->thumbnailFunction('fullhd', function ($image) {
    return $image->resize(1980, 1080, function ($constraint) {
        $constraint->upsize();
        $constraint->aspectRatio();
    });
})->thumbnailFunction('small', function ($image) {
    return $image->resize(800, 450, function ($constraint) {
        $constraint->upsize();
        $constraint->aspectRatio();
    });
})->pick(); // This will disable the thumbnail generation.

bytebrain avatar Nov 07 '23 16:11 bytebrain

@bytebrain i see what you mean and what happens.

Need a little bit of thinking on this on. Since the image is coming from the library, i`m wondering if direct modification of the image should be available. That's the reason this is disabled in the first place. For example preventing a crop on already existing image.

But i see the structure you setup coming in handy. Likely there need to be some extra checks. Any Ideas on how to make this work properly?

open-admin-org avatar Nov 24 '23 15:11 open-admin-org