<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/unit/file_upload_from_strings_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -352,6 +352,26 @@ module Fleximage
         end
       end
       
+      # Set the image for this record by reading in file data as a string.
+      #
+      #   data = File.read('my_image_file.jpg')
+      #   photo = Photo.find(123)
+      #   photo.image_file_string = data
+      #   photo.save
+      def image_file_string=(data)
+        self.image_file = StringIO.new(data)
+      end
+      
+      # Set the image for this record by reading in a file as a base64 encoded string.
+      #
+      #   data = Base64.encode64(File.read('my_image_file.jpg'))
+      #   photo = Photo.find(123)
+      #   photo.image_file_base64 = data
+      #   photo.save
+      def image_file_base64=(data)
+        self.image_file_string = Base64.decode64(data)
+      end
+      
       # Sets the uploaded image to the name of a file in RAILS_ROOT/tmp that was just
       # uploaded.  Use as a hidden field in your forms to keep an uploaded image when
       # validation fails and the form needs to be redisplayed
@@ -555,7 +575,7 @@ module Fleximage
         # Save the image in the rails tmp directory
         def save_temp_image(file)
           file_name = file.respond_to?(:original_filename) ? file.original_filename : file.path
-          @image_file_temp = file_name.split('/').last
+          @image_file_temp = Time.now.to_f.to_s.sub('.', '_')
           path = &quot;#{RAILS_ROOT}/tmp/fleximage&quot;
           FileUtils.mkdir_p(path)
           File.open(&quot;#{path}/#{@image_file_temp}&quot;, 'w') do |f|</diff>
      <filename>lib/fleximage/model.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/rails_root/tmp/fleximage/1x1.jpg</filename>
    </removed>
    <removed>
      <filename>test/rails_root/tmp/fleximage/1x100.jpg</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>d4951152335eddc938b7dd821e05717702020594</id>
    </parent>
  </parents>
  <author>
    <name>Alex Wayne</name>
    <email>alex@beautifulpixel.com</email>
  </author>
  <url>http://github.com/Squeegy/fleximage/commit/11f5772880344fc9d43f0e0142de6b446a56c9ed</url>
  <id>11f5772880344fc9d43f0e0142de6b446a56c9ed</id>
  <committed-date>2009-05-24T11:33:21-07:00</committed-date>
  <authored-date>2009-05-24T11:33:21-07:00</authored-date>
  <message>Allow images to be set via string data.  Fleximage::Model now has two new methods &quot;image_file_string=&quot; and &quot;image_file_base64=&quot;</message>
  <tree>34a911c4f58b3b696c8e456178b9d41693e8edf1</tree>
  <committer>
    <name>Alex Wayne</name>
    <email>alex@beautifulpixel.com</email>
  </committer>
</commit>
