LiipImagineBundle icon indicating copy to clipboard operation
LiipImagineBundle copied to clipboard

Add Provider Data/Path to 404 when creating images

Open tacman opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

Debugging a missing image could be easier. Describe the solution you'd like

image

It took me too long to figure out that I had a redundancy in my path

# config/packages/flysystem.yaml
# Read the documentation at https://github.com/thephpleague/flysystem-bundle/blob/master/docs/1-getting-started.md
flysystem:
    storages:
        default.storage:
            adapter: 'local'
            options:
                directory: '%kernel.project_dir%/public/images'

But I was passing

            {% set imagePath = '/images/%s/%s'|format(official.wikidataId, imageCode) %}
{{ imagePath | imagine_filter(''thumbnail') 

My error was duplicating /images in the argument passed to the filter.

My feature request is that more information be included in the error. If it said "could not be found in 'default.storage'" that would give me a starting point.

If it were able to get the directory from the options and tell me in the error message that /images/images/code couldn't be found, wow, that'd be awesome.

I have another issue somewhere related to this, where I'm trying to get the underlying filename. In that particular case, I wanted to know if the file was missing so I could download it before continuing, or at least trigger an async message to do so.

tacman avatar Jan 05 '24 01:01 tacman

is there an inner exception that provides more context?

and if not, would it be possible to improve the flysystem exception to tell the full path of what was not found?

dbu avatar Jan 06 '24 10:01 dbu