-
Notifications
You must be signed in to change notification settings - Fork 19
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
Feat: Dynamic Image Resizing #99
Comments
@nelsonic I am curious. ,You must probably have read this article. Since (obviously) you are using a server to upload image, what is the reason you did not consider to run your own Task to compress the image before saving to S3? You would save a bucket and a lambda. Something obvious I am missing? |
@ndrean hadn't seen that It's quite superficial, not really a "tutorial", more of a "you can do this thing" To answer your question: Ultimately using |
@nelsonic, Yes superficial indeed, but it gives ideas. But aren't you serving the client back with a compressed image? that's why I imagined it was an extra step (and I always fear AWS costs....). I forked the repo but did not run it yet but I plan to as I never did this server-side nor loaded files yet with Phoenix. But I have no intention so far to send something to S3, too much bills with AWS. I maybe totally wrong but I thought a simple I will also try the https://hexdocs.pm/image/Image.html and explore |
Yeah, the current Very curious to see your exploration of the https://github.com/elixir-image/image library. 👌 I'm especially not a huge fan of risk of crashing the whole If I can offload image processing/resizing to a totally separate |
@nelsonic I am exploring 2 ideas. If this does not interest you, just tell me (nicely 😄). I send the image from the browser (not from PHoenix) to a (tiny) companion Node.js server that runs
|
@ndrean these are all perfectly valid suggestions and we have done something similar in the past. our goal with doing this in Phoenix is to minimise latency. In the best case scenario API Gateway + Lambda is about 300ms round trip. Much worse if the Lambda function has to “cold” boot 🥶 Perhaps the most important thing we aren’t yet doing in the imgup app is logging metadata and person info so that the people making the uploads can see all their images easily. |
@nelsonic Of course, I do not pretend any originality at all. Just that I found the Phoenix code difficult. When you say "300ms round trip", you mean between upload and the display of the URL and preview of their pics?
I probably misunderstood. You mean a profile to be able to join his URLs and meta, thus retrieve? |
Yeah, for now this repo is “just” a simple way to upload images. If we had time we would build out the rest of the features. 💭 |
I imagine you want to use the "standard" |
Indeed. The “standard”, though woefully incomplete, mix phx.gen.auth is what we are using as the basis for our auth re-write which is ongoing … 👌 |
You probably know https://imagekit.io/ ? I found interesting the way they did it, and rather inline with your roadmap, Watch https://www.youtube.com/watch?v=sWcSYG1eifo however, the price seems high.
|
@nelsonic I believe I have a use case for a modal in the following situation: once you uploaded files, you have a list or miniatures previews of them. You can put a modal for each file to 1) link to a new page 2) a form to enter a name and download the file. What do you think? |
Respectfully, I disagree. 🙅 Interacting with a bank of images needs to be as "flat" as possible. Inserting a new Apologies if I come across as "harsh" (bordering on militant) but |
I used Vix to compress/resize ( |
Let me know what you think of this? it is only SSR because Phoenix transforms the images. When it reads a picture, I transform it into WEBP format to minimise the size. Only WEBP fomat are saved in S3. You can let the browser resize the pic for you, or minimise the data over the wire and resize it. Resize to what? To the uploading device for example? With this 100% Phoenix strategy, we could run a job to compute the resizing for different pre-defined devices, upload this to S3. You will have several versions of the same pic in S3. Then - upon some matching - when you want to display a picture, you "fetch" the right format depending upon your device. To keep it simple - and given I don't want to pay for - , if you upload a pic from a device, the image will be resized to the dimension of the device meaning that the S3 upload is adapted to your device. I do not keep the original format, just because this is a demo, but it is possible. This kind of app - with the jungle of the async messaging I used - could benefit of the new assign_async coming I tried to use it when you upload several files. Each upload will trigger a "writter" and then you invoke a start_async and |
At present we have single size image resizing: 7. Resizing/compressing files
This is a very good starting point, 👍
but it sets and artificial constraint
that ends up looking "meh" on most devices.
Story
As a
person
using multiple devices to view theApp
- that featuresimage
content -I want
images
to conform to the device/screen sizeSo that they always look their best.
As noted in #91 our friend has created https://github.com/jupiter/rust-image-worker
which appears to be well-documented and tested and runs on
Cloudflare
withCDN
caching. 🏎️While it currently does not have support for certain formats jupiter/rust-image-worker#3
But the underlying library does support
GIF
andWebp
: https://docs.rs/image/latest/image/enum.ImageFormat.html#variant.GifTodo
dynamic-resizing.md
The text was updated successfully, but these errors were encountered: