[Rails] Paperclip thumbnail generation uses magic?
I have been using CarrierWave for file uploads on a site which needs to accept a really wide range of different movie formats, stills, PDFs... And I have been struggling with making thumbnails of certain formats. After much yak-shaving with ffmpeg and imagemagick and Rmagick, I finally decided to do a little spike app with nothing but Paperclip. I set up the simplest thing that could possibly work:
has_attached_file :blob, :styles => { :thumb => ["320x320>", :png], :large => ["1500x1500>", :png] }
And no matter what format (within reason) I pass to it, I get a nicely formed PNG format thumbnail and large preview image. PSD, PDF, TIFF, MOV, M4V -- it Just Works™. And I cannot figure out how it is doing this, despite reading through the source code for quite a while.
The reason why I need to access the magic is that while I am getting a nice thumbnail from any movie format I pass in, I am getting the very first frame of the movie (usually black) rather than a few seconds into the clip. In my CarrierWave converter, I had a custom offset time defined for this. But I cannot see where Paperclip is defining what to do with a video to generate a PNG image so I can alter this default.
There are tons of examples on SO and the Web in general, showing how to create a custom video thumbnailer and transcoder, but I would like to avoid rebuilding this wheel that Paperclip seems to have hewn out of pure Elven magick.
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/87E1CB56-F23E-4EF2-A760-9F6D6A2C0B74%40wdstudio.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home