I'm using SonataMediaBundle and I don't want to generate icons for certain file types (e.g. pdf, xls, doc). I want to use a default icon (e.g. ).
I've been reading the Sonata Media documentation, and I believed that I need something like this:
web/uploads/media/media_bundle/images/default_pdf/file.png
or
web/uploads/media/sonatamedia/files/default_pdf/file.png
neither of which work.
On the chance that <format>
meant "small" or "large", I also tried this:
web/uploads/media/media_bundle/images/default_small/file.png
which I assumed would mean that file.png
would be shown for every file, regardless of mime-type, if a small icon were required and the file instance didn't have a custom one. I also tried using admin
instead of default
as the context. No dice.
The icon src is always /uploads/media/sonatamedia/files/admin/file.png
- which being an absolute path, does not actually exist.
My icon files are 45px wide, which I have set in config.yml:
formats:
small: { width: 45 , quality: 70}
big: { width: 500 , quality: 70}
pdf: { width: 45 , quality: 70} //tried with and without this line
File permissions are 644 and the cache has been cleared. What am I doing wrong?
In the docs, the example config shows:
cdn:
server:
path: /uploads/media # http://media.sonata-project.org/
I needed
cdn:
server:
path: /ACC/web/uploads/media # http://media.sonata-project.org/
because my site's base url is something like http://example.com/ACC I hope this is useful to others.