Below is my validations for image content type which works fine.
validates_attachment_size :icon, :less_than => MAX_SIZE.megabytes, :message => "Max size is 1 mb" validates_attachment_content_type :icon, :content_type => ['image/jpg','image/jpeg', 'image/png', 'image/gif']
BUT
I need to validate the dimensions also and my code is
validates_each :icon do |record, attr, value| if record.icon_file_name dimensions = Paperclip::Geometry.from_file(value.queued_for_write[:original]) if(dimensions.width > 600 || dimensions.height > 400) record.errors.add(:file, " #{record.icon_file_name} dimensions must be less than or equal to 600*400") end end end
AND
it gives imagemagick error Not recognized by the 'identify' command error
Can you put some light on this?
Thanks.