LiipImagineBundle: Multiple "Source image could not be found" since 1.7 update

Since the update to 1.7, I have problems with images not being found and therefore no image beeing generated by the bundle.

Error is “Source image could not be found”, and “[1/2] NotLoadableException: Source image invalid “C:\wamp\www\MyProject\src\MyBundle\Resources\public\images\icon.png” as it is outside of the defined root path”.

I haven’t changed my config

liip_imagine:
    resolvers:
        default:
            web_path: ~
    filter_sets:
        cache: ~
        thumb:
            filters:
                background: { size: [1140, 400], color: '#fff' }
                strip: ~

I’m also using VichUploaderBundle and the Symfony asset versioning system

framework:
    assets:
        version: 'X'

so my Twig looks either like

{{ asset('bundles/mybundle/images/icon.png'|imagine_filter('thumb')) }}

or

{{ vich_uploader_asset(enity, 'iconFile')|imagine_filter('thumb') }}

My assets are installed with symbolic links.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 34 (6 by maintainers)

Most upvoted comments

Solved with following config:

liip_imagine:
    # ...
    # see https://github.com/liip/LiipImagineBundle/issues/849
    loaders:
        default:
            filesystem:
                data_root: 
                    - "%kernel.root_dir%/../web"
                    - "%kernel.root_dir%/../../../shared/web"

For example, given the following folders within %kernel.root_dir%/../web

uploads/ (as regular folder)
other/ (as regular folder)
more/ (as regular folder)
symlink/ (as symbolic link to /some/other/path)

You would have the following as your config for data_root

data_root:
  - %kernel.root_dir%/../web
  - /some/other/path

@picks44 The way Symfony merges “array” configuration, your values for data_root will be merged together, meaning the "%kernel.root_dir%/../../../shared/web" path will always exist. For example, in production, your config would result in:

data_root:
  # from `config.yml`
  - "%kernel.root_dir%/../web"
  - "%kernel.root_dir%/../../../shared/web"

Whereas, in development environment, it would result in:

data_root:
  # from `config_dev.yml`
  - "%kernel.root_dir%/../web"
  # from `config.yml`
  - "%kernel.root_dir%/../web"
  - "%kernel.root_dir%/../../../shared/web"

To get around this merge handling of the Symfony Tree Building, move the config from config.yml into config_prod.yml, so that you have completely separate and independent configs for your production and development environments, without any merge functionality occuring on the liip_imagine block.


@picks44 Regarding “directory separators,” I don’t use Windows, but I do know on Linux you cannot use Windows directory separators. Perhaps Windows automatically allows the use of Linux separators; I have no experience working with PHP on this OS, though, so IDK.

@picks44 maybe are you using symlinks to cached image? I have same error with deployer and symlinks