Rails + aws-sk + S3 Object metadata multiple update - ruby-on-rails

I'm currently trying to work out the best way to update multiple S3 Objects MetaData within a single form.
Has anyone done this before or have any suggestions on how I could accomplish this?
I upload the files manually but wish to update some metadata i add when I upload manually. e.g. x-amz-meta-friendly-title, x-amz-meta-description, x-amz-meta-active
Any guidance is much appreciated.

Related

Get an image from URL and upload it to Firebase Storage

Is it possible to write a function to get an image from a url such as https://website.com/images/myImage.jpg and then automatically upload it to a Firebase Storage bucket?
I am trying to do it with multiple images in one go but am struggling to get one to work at the moment. My best attempt so far has seen me having to download the images, save them in the Media Library and then send them all up to Firebase, which surely cannot be the most efficient way?
In a nutshell, I have 10 images with URL's like the above and, when the function is fired I need them all to upload to my storage bucket, without the need to save them to the users device library.
Does anyone have any ideas on the most efficient way to do this please?

How to extract an image path and its date and time exif data from a filesystem into a database - Ruby on Rails

I want to use Ruby on Rails to make a simple web page that looks up the time an image was taken from exif data and looks up the current time and displays an image if both times match.
I'm going to put hundreds, maybe a few thousand images into a ruby on rails folder. I'll do this only once however and it will never change or be added to.
What's the best way to get the path of these images and also the corresponding exif data into an sql database? i dont really need an uploader if im dragging the images into the folder or am i wrong?
Would i be best served by using an external storage like amazon s3 and using active storage and something like exifr to extract the exif time data to the database and serve the image that way? as here:
https://www.georg-ledermann.de/blog/2018/05/15/exif-analyzer-for-active-storage/
Any help would be really appreciated. Thanks. im really trying to get my head around this before attempting a start.
I used exif gem a while ago, I think it's exactly what you're
looking
gem install exif
brew install libexif
load data from the file
data = Exif::Data.new(File.open('sample.jpg'))
data.date_time # output => "2019:01:08 21:14:11"
Take a look at the gem documentation for more options

Uploaded timestamp with Carrierwave

I have a model containing several PDFs that are stored on S3 using Carrierwave, and would like to display the uploaded_at timestamp of these files in a view.
I don't see any way to accomplish this built into Carrierwave. Right now I plan to add an uploaded_timestamp field to the model, but am looking for a more elegant way to accomplish this.
Suggestions welcome.

Creating a table entry while using CarrierWaveDirect

Is it possible to use something like CarrierWaveDirect to upload directly to S3 and still be able to gather some data on the files being uploaded?
For instance, is it possible to change the filename, and save the size in a table before/after the upload? I don't need to do any kind of manipulation to the file either (I was reading some documentation regarding the use of Resque).
I realize that this is a very novice question but I couldn't find the answer anywhere.
After a lot of fiddling, I found out that the S3 secure upload form that the hidden field success_action_redirect returns so params on the uploaded file.

Creating a Rails Music Player App (something like Rdio)

i want to create a rails app that has a lot of mixtapes, which the user can listen to and download (like datpiff.com). All the mixtapes would be uploaded by me. Each mixtape would have their own page, with the title, artist name, cover, etc.
I'm having trouble getting the architecture of the app right. What's the best way to upload all the mixtapes. (I'm thinking something like Amazon S3).
Do I have to upload a zipped file with the entire mixtape, and each individual song, or just the zipped file.
How do i show the information of each song (title, length, etc)
Ofcourse the biggest problem is the streaming of the mixtape, and the download of the file.
Can anyone guide me as to whats the best way to create this app. (Is Rails the best way to do it?)
Thanks in advance.
You're on the right track with S3. Use paperclip in conjunction with it if you want to make some sort of GUI for you to upload stuff with.
For streaming check out jPlayer, which is a jQuery plugin.
Download's no biggie. Check out Rails' send file. For sending from a remote source like S3, look here.

Resources