-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
How to Reduce Number of Requests to Remote Storage #471
Comments
Reading the docs, I think I may be able to get away with not knowing the orientation, for my current use case: If width and height are given the image is rescaled to maximum values of height and width given. Aspect ratio preserved. It may be acceptable for me to specify two maximums ( For example, I am wanting to pre-cache at least 3 thumbnails per raw image. I see this is causing Thanks! |
👍 |
@mariocesar, could I ask you to please give your opinion here about the best way to avoid hitting remote storage N times for making N different thumbnails of the same image? Thanks! |
Currently the only complete solution is to rewrite the serialization, specially the naming and file management behavior of sorl.thumbnail, as it fully relies on how the django file backend, and this is not optimized at all. The current implementation will be always rely in the django file backend, and moving out is the only opportunity to apply any of the optimizations we can think of. Like bulk creation of thumbnails, where we can cache the images metadata and avoid fetching that again and again. Also having customs namings so we avoid serializations and store hashs at alls, that case is not common for all but there are users that will like to have thumn_200x200_crop.jpg, instead of the current hashed name. A well known workaround is, if is possible for you, you can not to use the {% thumbnail %} tag, and prebuild all the thumbnails before serving, and store the resulting thumbnail url in your db, or rename it to something like /product/thumb.jpg. Anyway, this is really core to the current implementation. And moving out from the dependency of the django file system engine is one step. |
Hi Mario, thank you for your fast feedback. Yes, I am using that workaround, I think. I do use the I guess I don't really understand why it would be so hard to take a raw Thanks for your input! On Mon, Nov 7, 2016 at 7:34 AM, Mario César [email protected]
|
So my idea above more fleshed out -- If That looks like a really simple change. Would that work @mariocesar ? |
@mariocesar Your last feedback was very helpful, could I trouble you for a follow-up on my last comment please? |
@mariocesar Thanks for the lengthy input you gave. Would you mind commenting on my followup? I proposed something that looks easy, which I might implement if you agreed. |
My service has users upload raw images directly to AWS S3. I use sorl-thumbnail to produce a thumbnail with dimensions depending on its orientation
My problem is that in order to determine the dimensions, I call
is_portrtait
first, which apparently triggers aGET
on the large raw image. Then I get the thumbnail with something like"500x"
or"x500"
which triggers anotherGET
.I can't think of many options here:
sorl
so it doesn't issue another request.What's the best way to avoid two requests?
The text was updated successfully, but these errors were encountered: