Consider I have two domains.
- http://app.com/ => /home/app/web
- https://images.app.com/ => /home/images/directory/
There is a form in app.com which can upload images to /home/images/directory
.
The question is : Is there a way that the bundle can generate the image on the /home/images/directory/
or do we need to write our own cache resolvers ?
I have tried flysystem resolver .
Eg : Consider image is located at /home/app/web/a42e93fb7d08c90a160da87a5dc91028.png
and inside twig we can use
<img src="{{ 'a42e93fb7d08c90a160da87a5dc91028.png' | imagine_filter('my_thumb') }}" />
This actually creates a url as : http://images.app.com/media/cache/my_thumb/a42e93fb7d08c90a160da87a5dc91028.png
But this will not create image in /home/images/directory/media/cache/my_thumb/a42e93fb7d08c90a160da87a5dc91028.png
bin/console liip:imagine:cache:resolve ../data/img/product/a42e93fb7d08c90a160da87a5dc91028.png --filters=my_thumb
throws source path is outside the defined root path.
[Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException]
Source image was searched with '../data/img/product/a42e93fb7d08c90a160da87a5dc91028.png' out side of the defined root path
I have found this is where that cause trouble.
The config.yml
is as
//app/config.yml
liip_imagine:
resolvers:
product_images:
flysystem:
filesystem_service: oneup_flysystem.product_images_filesystem
root_url: "http://img-loc.app.com/"
cache_prefix: media/cache
# visibility: public
default:
web_path: ~
# your filter sets are defined here
filter_sets:
cache: ~
# the name of the "filter set"
my_thumb:
cache: product_images
quality: 75
filters:
thumbnail: { size: [120, 90], mode: outbound }
oneup_flysystem:
adapters:
product_images:
local:
directory: '%kernel.root_dir%/../../data/img/product'
filesystems:
product_images:
adapter: product_images
Thank you