liip / LiipImagineBundle

Symfony Bundle to assist in image manipulation using the imagine library
http://liip.ch
MIT License
1.66k stars 378 forks source link

Add Provider Data/Path to 404 when creating images #1555

Open tacman opened 10 months ago

tacman commented 10 months ago

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.

dbu commented 10 months ago

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?