Ruby on Rails Friday, August 9, 2013

I need to duplicate an object that has an attached Paperclip file. This file (depending on its file-type) may have two to four different styles, with separate file-processing stages required for each. Some of these involve transcoding in FFMPEG, so I would really rather not run the processors all over again, when the various re-coded versions already exist on S3.

The naive thing (which I have done, and works) is simply to create a new object, open the original file from S3 using open-uri, and run the process over again. This works, but takes a long time, since some of these movie files are large and the processing steps to make thumbnails and poster frames are weighty.

Searching for solutions on this, I came across the dup method, and I also saw a dup method on the Paperclip attachment when I inspected its methods. Before I go into a lengthy yak-shaving exercise here, can anyone point me to a simpler way to manage what I am trying to accomplish here? Essentially I want to duplicate a group of files in place on S3 (yes, I realize you can't do that without copying them) but I want to skip all the processing steps and just duplicate the styles "manually".

Thanks in advance,

Walter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/930C9291-C70A-44B1-8ADE-932327D2D0CE%40wdstudio.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment