-
Notifications
You must be signed in to change notification settings - Fork 379
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
'formats' not used by Stream Loader #231
Comments
The purpose is to be able to convert a file from one format to another. |
@lsmith77 but the loader will still not be able to find the original file. Because it uses the given path as the "source path". I agree with having "format" as an option, so that the generated result will be done in whatever format you specify, but the proper original path should be provided and not overwritten as is the case, maybe it should render something like /&force=jpg? I don't mean 'why is the feature in there' i mean 'why is it implemented overriding the source url' |
Any stance on this? I need to find a solution, would be better if the solution is in line with your goals so i can contribute it back to you. |
i might still not understand properly what you mean .. we need to embedd url into the html, this url should specify the format as is intended in the final output as otherwise its just a mess for outside systems (serving a jpg with .gif because the source image is a gif). so our url already needs to have the target extension. adding some hints as query parameters as to the original format etc while possible would also result in some unwanted behavior. for example many reverse proxies and browser caches react iffy to query parameters on otherwise static files. |
@lsmith77 so how do you use the combination of StreamResolver + original image in png + desired output jpg ? Right now its not doable since the StreamResolver does not know how to search for the original image and just looks for |
i don't know the StreamResolver .. it can of course be that for certain storage backends there is no way to support all features. which in this case might be not supporting the format option or making it possible (not sure how hard this is) for the storage backend to be able to add some query parameters in case it needs additional hints to find the original. |
not being able to use I'll take a look at options. |
also, sorry StreamLoader not Resolver. |
Simply spoken, it's just missing the iteration code in the I would suggest to extend the |
@havvg Yes that is what i have done, its just a shame for the bundle to offer a situation where a frequent combination of its own options clashes and crashes it. |
You got a generic solution for it, do you mind sending a PR for it? |
@havvg its not very generic, but since we store the filename in the DB it checks the DB for the file based on its name (unique md5's) and gets the original extension. So it depends heavily on the way you store stuff. |
It would be good to make the limitation clear in the docs and then provide your solution for an example work around |
What about this: Url in the form : The controller extract We might output only one extention if the source file already contains one and the output format is the same. This should work with any DataLoader. |
There is a problem with my previous suggestion, there is no way to distinguish between an id without extension with extension added and an id which already has the good extension. May be something like this whould be better:
We have the same problem if the id ends by |
I'll close this. As mentioned in #277 we will take a look into this for v1.0.0. |
if a profile configures the
format
parameter to, for example,jpg
the url that is written for the image tag will override the extension:/uploads/image.png
becomes/uploads/image.jpg
In the
FileSystemLoader
this is overcome by iterating over theformats
option until a file is found with one of the alternate extensions. (see code)However, the same is not true for the StreamLoader. So essentially ImagineBundle changes the url, forcing the format, and then is never capable of finding the original file.
Iterating over alternative formats in the stream case may be a bit more resource heavy, so I think the solution would be to address the "why" urls are rewritten and try to handle that in the output not in passing the filename.
What do you guys think is our best way out here?
The text was updated successfully, but these errors were encountered: