RMagick Question

The get_exif_by_number() method returns the date in a format different from can be parsed by default rails string_to_date or parse() method.

Is there a helper that is readily available for this? -

Load the file

m_file = ImageList.new(“DSC02465.JPG”) => [DSC02465.JPG JPEG 1219x914 1219x914+0+0 DirectClass 8-bit 490kb] scene=0

Get the datetime when the picture was taken

m_file.get_exif_by_number(36867)[36867] => “2005:10:04 06:31:31.”

Load into a table with datetime type by first converting it to Time

ActiveRecord::ConnectionAdapters::Column.string_to_date(m_file.get_exif_by_number(36867)[36867]) => nil

Any suggestions?


Try ParseDate:

model.time = Time.mktime(ParseDate.parsedate("“2005:10:04 06:31:31”))