media-bundle icon indicating copy to clipboard operation
media-bundle copied to clipboard

Imagine with Doctrine\Phpcr\Image documents

Open dbu opened this issue 11 years ago • 2 comments

when i try to use imagine with an Image document, i get

Parameter "path" for route "_imagine_my_filter" must match ".+" ("" given) 
to generate a corresponding URL

it works if i add a __toString method to the image that returns $this->id. it seems like LiipImagineBundle is not expecting to be passed an object but only a path to an object. can we make that work? things go wrong inside CacheManager / WebPathResolver. could we use a different path resolver?

workaround: if i pass in the id instead of the Image document, things work so at least there is a workaround.

dbu avatar Sep 16 '13 16:09 dbu

Maybe this can be solved on LiipImagineBundle side, some ideas:

  • using an LiipImagineBundle interface that is implemented on the Doctrine\Phpcr\Image document
  • using a PathResolverManager that can handle multiple path resolvers, then we could inject one for ImageInterface objects
  • or simply add some mapping, so it can be configured what field is used to get the path per interface/ class

rmsint avatar Sep 16 '13 19:09 rmsint

right now the parameter to the imagine filter is called $path and expected to be a string. maybe there is a way to extend WebPathResolver to a ImageOrWebPathResolver and configure LiipImagineBundle to use that.

anyway, its not a 1.0 critical thing, as passing image.id is a working solution.

dbu avatar Sep 17 '13 07:09 dbu