Ruby on Rails - Video Upload with Paperclip & FFmpeg ffmpeg 를 이용하여 Paperclip 으로 동영상 첨부하는 것을 다루도록 하겠습니다. 요구사항Paperclip 에서 FFMPEG 나 AVCONV 를 이용해서 동영상을 다루기 때문에 미리 FFMPEG 나 AVCONV 가 설치되있어야 합니다. which ffmpeg 명령어를 통해 ffmpeg 가 설치 되어 있는지 확인하시고 없으면 아래 링크를 통해 설치하시면 됩니다. 2014/09/07 - [OS/리눅스&우분투] - 우분투에서 ffmpeg 설치 또한 Quicktime/MP4 파일들의 metadata 와 offset 정보들을 제거해 streaming 과 pseudo-streaming 을 가능케 하는 qtfast..
어떠한 Action을 취한 후 이전 URL로 돌아가는 경우는 흔히 있다. 예를들어 해당 게시글을 수정 혹은 삭제 후 다시 원래 URL로 돌아가는 것이 당연하다.이를 구현하기 위해서는 해당 Controller 에서 이전 URL을 저장하고 Action이 끝난 후 저장해둔 URL로 redirection 시켜주면 된다. 예를들어 해당 report 삭제 후 다시 url 로 돌아가는 것을 구현하고자 하면 destory action에 이전 url을 저장한다.store_location 은 private method 로 다음와 같다. 그리고 원하는 행동(예제에서는 해당 report 를 destroy 후) redirect_to 를 이용해 저장해둔 url로 redirection 시켜주면된다.
Rails 4 에서 Paperclip 과 Image Magick 으로 파일 업로드 및 이미지 처리를 할 수 있습니다. Paperclip 을 이용한 프로필 사진 기능을 만들어보도록 하겠습니다. Requirements1. Ruby 버전 1.9.2 이상2. Rails 버전 3.0 이상3. ImageMagick 설치 1. ImageMagick 설치$ sudo apt-get install imagemagick$ sudo apt-get instal libmagickwand-dev 2. Paperclip gem 설치Gemfile 에 추가gem "paperclip", "~> 4.1"$ bundle install 3. User 모델에 컬럼추가$ rails g paperclip user avatar$ rake db:mig..
#253 CarrierWave File UploadsLet’s say that we are building a site that allows artists to upload their paintings and display them in a gallery. Part of the site is already built: there is a page that lists the galleries, with a link to each gallery and a page that shows a gallery’s pictures. Each painting has a name and a placeholder for an image but no image. If we try to add a new painting to ..