Sha256: d1a1a5c58ec57327de955e7a9ba0398751be40069bf230c2b3c7fa633743373e
Contents?: true
Size: 524 Bytes
Versions: 2
Compression:
Stored size: 524 Bytes
Contents
module Kublog class Image < ActiveRecord::Base validates_presence_of :file mount_uploader :file, FileUploader attr_accessible :file, :alt before_create :set_default_alt before_validation :get_dimensions private def set_default_alt self.alt = file_url.match(/([\w|\b|\s\-]+)\.[png|jpg|gif|jpeg]+/)[1] end def get_dimensions self.file_width, self.file_height = `identify -format "%wx %h" #{self.file.path}`.split(/x/) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kublog-0.9.0 | app/models/kublog/image.rb |
kublog-0.0.1.1 | app/models/kublog/image.rb |