Saving extracted data


#1

Hi there,

I have a file upload form on my page that is for images. In the model I
have
this:

def file_data=(file_data)
@file_data = file_data
write_attribute ‘extension’,
file_data.original_filename.split(’.’).last.downcase
write_attribute(“content_type”, file_data.content_type)
write_attribute(“current_name”, file_data.original_filename)
write_attribute(“file_size”, file_data.size)
read_attributes(file_data)
end

I also want to read the attributes of the EXIF data embedded in the
picture
doing something like this (this the short form):

def read_attributes(file_data)
img = Magick::Image.from_blob(file_data.read)
camera_makeimg.get_exif_by_entry(‘Make’)
write_attribute(“camera_make”, camera_make)
end

However, when I do this I get an error of:

undefined method `get_exif_by_entry’ for [ JPEG 3504x2336 3504x2336+0+0
DirectClass 8-bit 3544kb]:Array

get_exif_by_entry is a method for ImageMagick
http://www.imagemagick.org/RMagick/doc/image2.html#get_exif_by_entry

I’m a little lost at the moment.

Any ideas?

Thank you,
Dave H.