Sha256: ba72e69127ed62c2bc1d613cab5abd84d2370e8a499d1990f978e7e65827bb0a
Contents?: true
Size: 774 Bytes
Versions: 2
Compression:
Stored size: 774 Bytes
Contents
class UserImageHolder < ActiveRecord::Base include Magick unless self.include? Magick belongs_to :user, primary_key: :username, foreign_key: :user_username def uploaded_image= (image_params) if image_params[:remove_image] && image_params[:remove_image] == "1" self.destroy elsif image_params[:image_file] && !image_params[:image_file].blank? self.filename = image_params[:image_file].original_filename self.content_type = image_params[:image_file].content_type data = image_params[:image_file].tempfile.read self.image_data = Image.from_blob(data).first.resize_to_fit(100, 100).to_blob self.image_thumb = Image.from_blob(data).first.thumbnail(35, 35).to_blob elsif self.new_record? self.destroy end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
watarase-0.0.3 | test/dummy/app/models/user_image_holder.rb |
watarase-0.0.2 | test/dummy/app/models/user_image_holder.rb |