-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File path in twig #234
Comments
As easy as it can get! :) Just configure your upload directory: oneup_uploader:
mappings:
gallery:
storage:
filesystem: %kernel.root_dir%/../web/uploads/gallery and in twig you can use it like this: <img src="/uploads/gallery{{ image.path }}" /> |
I wanted a more dynamic way, like maybe a twig function, but then I realized I will be using LiipImagineBundle so, ill be using its function. Thanks anyway. |
I thought about it again, i want to make this as a feature request. The way you suggested is easy, but it isn't much helpful if i were to change the directory. I would have to edit everywhere else, one by one. A function that can do this procedure you suggested without anyone having to do it. It would be nice, I guess. |
And suppose you say no to this, here is a gist I created that you can refer to people at least who would want it. This shows how to create a helper function for controller and twig. I hope you don't mind. |
I'd also be interested in this, I'dl like to crop the image after it's been uploaded, and the cropper I use needs the filer URL, so I'd like to have it in the response object. |
@jstoeffler Try the gist I suggested for the time being if you want to, https://gist.github.com/deviprsd21/5bd4bc827ee7991640c4 |
How will I get the file path in twig? I previously used viichuploader, and it had a twig function to generate the file url! I don't want to save the file path in the database, to save database size.
The text was updated successfully, but these errors were encountered: