Sha256: c464b3d9a08db979830e71bb3cff171fb3e1a6f0e5d198b930a1efdd13e67b20

Contents?: true

Size: 1.23 KB

Versions: 22

Compression:

Stored size: 1.23 KB

Contents

module C80Yax

  # грузит картинку услуги
  class IphotoUploader < BaseFileUploader

    process :resize_to_limit => [1024,768]

    # накладываем watermark
    process :watermark => [Rails.root.join('public/watermark.png')]

    version :thumb_sm do
      begin
        p = C80Yax::Prop.first
        process :resize_to_fill => [p.thumb_sm_width, p.thumb_sm_height]
      rescue => e
        Rails.logger.debug "[TRACE] <iphoto_uploader.thumb_sm> [ERROR] #{e}"
      end
    end

    version :thumb_md do
      begin
        p = C80Yax::Prop.first
        process :resize_to_fill => [p.thumb_md_width, p.thumb_md_height]
      rescue => e
        Rails.logger.debug "[TRACE] <iphoto_uploader.thumb_md> [ERROR] #{e}"
      end
    end

    version :thumb_lg do
      begin
        p = C80Yax::Prop.first
        process :resize_to_fill => [p.thumb_lg_width, p.thumb_lg_height]
      rescue => e
        Rails.logger.debug "[TRACE] <iphoto_uploader.thumb_lg> [ERROR] #{e}"
      end
    end

    def watermark(watermark_image, options={})
      cache_stored_file! unless cached?
      C80Yax::Watermarker.new(current_path, watermark_image).watermark!(options)
    end

    def store_dir
      'uploads/items'
    end

  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
c80_yax-0.1.0.25 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.24 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.23 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.22 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.21 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.20 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.18 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.17 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.16 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.15 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.14 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.13 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.12 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.11 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.10 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.9 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.8 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.7 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.6 app/uploaders/c80_yax/iphoto_uploader.rb
c80_yax-0.1.0.5 app/uploaders/c80_yax/iphoto_uploader.rb