Skip to content

Not showing image when edit a resource item #19

Description

@wemersonrv

Hi, i crop and upload the image fine and it's shown right in index and details page. But when edit a row, the image is not shown. See my code:

ImageCropper::make('Avatar', 'avatar')
    ->disk('my_custom_disk')
    ->path('images/usuarios/'.str_pad($this->id, 10, "0", STR_PAD_LEFT))
    ->preview(function () {
        if (!$this->value) return null;

        $url = Storage::disk($this->disk)->url($this->value);
        $filetype = pathinfo($url)['extension'];
        return 'data:image/' . $filetype . ';base64,' . base64_encode(file_get_contents($url));
    })->avatar(),

I think it's a good idea to preview the image when editing too... but only update it when user re-crops the image, upload & crop a new image.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions