Hi Radhames, do you mind showing what you have for the processor at /
lib/paperclip_processors/your_processor_lib.rb ?
On Oct 1, 10:13 pm, radhames brito <rbri...@gmail.com> wrote:
> On Fri, Oct 1, 2010 at 9:38 AM, Christian Fazzini <
>
> christian.fazz...@gmail.com> wrote:
> > Im using a customs processor to run ffmpeg on a video to create a
> > thumbnail.
>
> this here is how i do it
>
> def create_thumbnail
> jpg = File.join(File.dirname(vidfile.path), "#{id}.jpg")
> File.open(jpg, 'w')
> command = <<-end_command
> ffmpeg -itsoffset -4 -i #{ vidfile.path } -y -vcodec mjpeg -vframes 1
> -an -f rawvideo -s 160x120 #{ jpg }
> end_command
> command.gsub!(/\s+/, " ")
> end
>
> you have to manually delete the file on destroy since paperclip is only
> aware of the file i uploaded which it the video file and will not delete the
> jpg file.
>
> File.delete(@vidfile.path.gsub(/flv/,"jpg"))
>
> also you have to delete the original, and update the db entry
>
> def set_new_filename
> File.delete(vidfile.path)
> update_attribute(:vidfile_file_name, "#{id}.flv")
> update_attribute(:vidfile_thumb, "#{id}.jpg")
> end
>
> i also set everything in an starling worker
>
> ConvertWorker.async_convert_video(:file_path => vidfile.path)
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment