File Handling in Phoenix

Anyone felt the need for shrinerb/shrine: File Attachment toolkit for Ruby applications (github.com) sort of a library in Phoenix?
There is elixir-waffle/waffle: Flexible file upload and attachment library for Elixir (github.com) - but - not actively maintained - and - not LiveView compatible.
Phoenix LiveView does support File Uploads in a very beautiful way - it supports drag and drop, upload progress and cancel partial uploads etc. - but - boilerplate code is necessary to process the uploaded file into even local system.
Rails has two main solutions to the same problem. Rails framework itself supports ActiveStorage and then we have Shrine. Adding a file to a model is as simple as declaring any other attribute. Image Processing, Cloud Storage, Updating the Model with processed file string are all supported - and - via plugins.
Do you think such a library will help in Phoenix as well? Or there any limitations due to immutability etc.? Shrine supports ROM also which is similar to Ecto. So, in my view there should not be any issues.
But, I would want to hear your thoughts.
What problems do you perceive, if we mimic and translate Shrine into elixir?

2 Likes

Hi, maybe arc-ecto could help you:

1 Like

I am using live file upload with waffle and waffle-ecto.

Rails use polymorphic links (type + id)

I think arc is even less maintained than waffle :slight_smile:

1 Like

@karlosmid - waffle is a clone of arc - because arc was not being maintained.
@kokolegorille -

  1. any github/gist links for the setup with LiveView and Waffle?
  2. I agree - polymorphic links can be a bottleneck.
    Personally, I feel waffle itself needs an upgrade - It should include akash-akya/vix: Elixir extension for libvips (github.com) or kipcole9/image: Image processing for Elixir (github.com) and delegate image processing to such libraries. A few more requirements as well. Let me see if I can get inspired from all these resources and produce something useful.
1 Like