Recherche avancée

Médias (3)

Mot : - Tags -/pdf

Autres articles (61)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (8570)

  • Validation failed : Video Paperclip::Errors::NotIdentifiedByImageMagickError

    28 mars 2017, par ACIDSTEALTH

    I have a model with an attached video. I want to create a scaled version of the video along with a series of thumbnails. I have the following setup :

    has_attached_file :video,
       styles: {
           original: { format: 'mp4', processors: [:transcoder] },
           large: { geometry: "720x720", format: 'jpg', processors: [:thumbnail] },
           medium: { geometry: "540x540", format: 'jpg', processors: [:thumbnail] },
           thumb: { geometry: "180x180", format: 'jpg', processors: [:thumbnail] }
       },
       default_url: ""

    When I test this in my development environment it works perfectly. The video and all images are correctly sized. When I deploy to Heroku however, I get the following error :

    Validation failed: Video Paperclip::Errors::NotIdentifiedByImageMagickError
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/validations.rb:78:in `raise_validation_error'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/validations.rb:50:in `save!'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/transactions.rb:324:in `block in save!'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `block in transaction'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/transactions.rb:211:in `transaction'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/transactions.rb:324:in `save!'
    /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.2/lib/active_record/suppressor.rb:45:in `save!'
    /app/app/models/concerns/snapshot_methods.rb:37:in `copy_from_ziggeo!'
    /app/app/workers/snapshot_transcoder.rb:16:in `perform'
    /app/vendor/bundle/ruby/2.3.0/gems/resque-status-0.5.0/lib/resque/plugins/status.rb:161:in `safe_perform!'
    /app/vendor/bundle/ruby/2.3.0/gems/resque-status-0.5.0/lib/resque/plugins/status.rb:137:in `perform'

    What am I missing here ? I’ve searched for NotIdentifiedByImageMagickError and scanned numerous other questions on this issue, but have not had any success fixing my problem.

    Most of the solutions I’ve seen involve setting Paperclip.options[:command_path] = "/usr/bin/identify" in development. Since my problem is only on production, I tried applying this to production, subbing in the correct path for my production environment, like so :

    Paperclip.options[:command_path] = "/app/vender/imagemagick/bin/identify"

    This had no effect. Neither did /app/vender/imagemagick/bin.

  • Paperclip geometry ignored

    27 mars 2017, par ACIDSTEALTH

    I have a model called Snapshot, which represents a user-recorded video. I want to take the input video file and scale it to fit within a 720x720 box (ImageMagick documentation). I then want to capture some screenshots of the video to represent it in my app. These sizes are specified accordingly in my model.

    I expect the output of this to be an original video with a maximum width of 720px (assuming it was recorded in landscape mode), a large JPG image with a maximum width of 540px, etc.

    When I attach the video file and save the model, the images and video file are processed but the result is not what I expected. The video file has a resolution of 960x720 and the images are all square (540x540, 360x360, etc).

    I’m not sure if I’m doing something wrong or if this is just a bug with Paperclip. Here is my code :

    class Snapshot < ApplicationRecord
       has_attached_file :video,
           styles: {
               original: { geometry: "720x720", format: 'mp4' },
               large: { geometry: "540x540", format: 'jpg' },
               medium: { geometry: "360x360", format: 'jpg' },
               thumb: { geometry: "180x180", format: 'jpg' }
           },
           default_url: "", processors: [:transcoder]
       validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
       validates_attachment_size :video, less_than: 100.megabytes
    end

    I have also tried adjusting the geometry to 720x720>, 540x540>, etc. When I did this, the attachments’ resolution was unchanged, which seems to go completely against my understanding of how ImageMagick geometry works. I have numerous other models with image-only attachments that do not suffer from this issue.

    Here is a snippet from my Gemfile.lock so you can see which versions I am running :

    delayed_paperclip (3.0.1)
     activejob (>= 4.2)
     paperclip (>= 3.3)
    paperclip (5.1.0)
     activemodel (>= 4.2.0)
     activesupport (>= 4.2.0)
     cocaine (~> 0.5.5)
     mime-types
     mimemagic (~> 0.3.0)
    paperclip-av-transcoder (0.6.4)
     av (~> 0.9.0)
     paperclip (>= 2.5.2)
    paperclip-optimizer (2.0.0)
     image_optim (~> 0.19)
     paperclip (>= 3.4)

    Update
    I retried this with a video recorded in portrait mode (iPhone 6 front-facing webcam) and the video file’s output size was 720x720. The images were still square as before.

  • Paperclip Upload Video Without Styles

    16 mars 2017, par Moamen Naanou

    Background :

    In my app, there is a model has image attachment using paperclip gem, now as per new requirements, I have to let the same attachment accept MP4 video files as well and the only validation I have to implement is about file size.

    Product Model (with image attachment only) :

    class Product < ActiveRecord::Base
     has_attached_file :file,
                       :styles => { medium: '300x300>', thumb: '100x100>' },
                       :processors => [:thumbnail],
                       :url => '/assets/:id/:style/:hash.:extension',
                       :hash_digest=>'SHA1',
                       :use_timestamp => false


     validates_attachment_content_type :file, :content_type => /\A(image)\/.*\Z/
     validates_attachment_size :file, :less_than => 5.megabytes
    end

    So after reading many related questions, to accept a video file as well, I’ve used gem paperclip-av-transcoder and installed ffmpeg (Mac) using :

    brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libas

    Then finally I’ve revised my model to be :

    class Product < ActiveRecord::Base
     has_attached_file :file,
                       :styles => lambda {|file| if file.instance.is_image?
                                                   { medium: '300x300>', thumb: '100x100>' }
                                                 elsif file.instance.is_video?
                                                   {:thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10}}
                                                 end },
                       :processors => lambda {|file| if file.is_image?
                                                       [:thumbnail]
                                                     elsif file.is_video?
                                                       [:transcoder]
                                                     end},
                       :url => '/assets/:id/:style/:hash.:extension',
                       :hash_digest=>'SHA1',
                       :use_timestamp => false


     validates_attachment_content_type :file, :content_type => /\A(image|video)\/.*\Z/
     validates_attachment_size :file, :less_than => 5.megabytes

     def is_video?
       file_content_type =~ %r(video)
     end

     def is_image?
       file_content_type =~ %r(image)
     end
    end

    Now the file field accepts both videos & images but the video shouldn’t be compressed, because if it is compressed, I will get IO Error [Closed Stream]

    Question :

    I’m expecting compressed MP4 file to be received from Mobile client(through REST API) and I don’t want to generate any thumb image or any other style or do any processing on this video and without installing any processor (ffmpeg in my case) and if I did so currently, I’m getting the following error because ImageMagic doesn’t work with video files :

    Paperclip::Errors::NotIdentifiedByImageMagickError

    Any ideas ?