<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -7,24 +7,22 @@ class ImageFile &lt; ActiveRecord::Base
   belongs_to :still_image
 
   # handles file uploads
-  # this will require overriding full_filename method locally
-  # processor none means we don't have to load expensive image manipulation
-  # dependencies that we don't need
-  # :file_system_path =&gt; &quot;#{BASE_PRIVATE_PATH}/#{self.table_name}&quot;,
-  # will rework with when we get to public/private split
   # Rmagick is default processor for thumbnails
-  # TODO: we may want better square cropping via overriding resize_image
+  # better square cropping via overriding resize_image in plugin in place
   # from vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick.rb
-  # locally, or possibly by image_science later
-  # TODO: have all files converted to jpegs, possibly done by changing filename of thumbnails
-  # i.e. should just mean that you replace source extension suffix with desired suffix (.jpg)
-  # in the saved filename
-  # we use image_thumbs for our resized images
-  # so we that on save for each resized version, we don't get a call to acts_as_zoom
-  # :file_system_path =&gt; &quot;public/images&quot;,
-  has_attachment :storage =&gt; :file_system,
-  :content_type =&gt; IMAGE_CONTENT_TYPES, :thumbnails =&gt; IMAGE_SIZES,
-  :max_size =&gt; MAXIMUM_UPLOADED_FILE_SIZE
+  # we also make non-web friendly image files end up with jpegs for resized versions
+  # see lib/resize_as_jpeg_when_necessary
+  attachment_options = { :storage =&gt; :file_system,
+    :content_type =&gt; IMAGE_CONTENT_TYPES,
+    :thumbnails =&gt; IMAGE_SIZES,
+    :max_size =&gt; MAXIMUM_UPLOADED_FILE_SIZE }
+
+  # allow sites to opt-in for keeping embedded metadata from original with resized versions
+  if Object.const_defined?('KEEP_EMBEDDED_METADATA_FOR_ALL_SIZES') &amp;&amp; KEEP_EMBEDDED_METADATA_FOR_ALL_SIZES
+    attachment_options[:keep_profile] = true
+  end
+
+  has_attachment attachment_options
 
   validates_as_attachment
 </diff>
      <filename>app/models/image_file.rb</filename>
    </modified>
    <modified>
      <diff>@@ -575,3 +575,11 @@ system_settings_066:
   id: &quot;66&quot;
   value: &quot;false&quot;
   section: Flagging
+system_settings_067:
+  name: Keep Embedded Metadata For All Sizes
+  technically_advanced: true
+  required_to_be_configured: true
+  explanation: &quot;When creating the different versions of uploaded images, such as thumbnails, should we keep the embedded metadata with the new version of the image? Not transferring embedded metadata to the new versions can make them significantly smaller, especially if the original has an embedded thumbnail version already. On the other hand embedded metadata may contain information that is important to keep, such as copyright holder.&quot;
+  id: &quot;67&quot;
+  value: &quot;false&quot;
+  section: Images</diff>
      <filename>db/bootstrap/system_settings.yml</filename>
    </modified>
    <modified>
      <diff>@@ -54,7 +54,7 @@ module ResizeAsJpegWhenNecessary
     end
 
     def resize_image(img, size)
-      img.strip! # remove metadata from the resized image
+      img.strip! unless attachment_options[:keep_profile] # remove metadata from the resized image
       img.format = 'JPEG' # set format to JPEG
       self.temp_path = write_to_temp_file(img.to_blob { self.format = 'JPEG' }) if self.class.should_be_converted?(img.format)
       super</diff>
      <filename>lib/resize_as_jpeg_when_necessary.rb</filename>
    </modified>
    <modified>
      <diff>@@ -58,13 +58,19 @@ namespace :kete do
       end
     end
 
-    desc 'Resize original images based on current IMAGE_SIZES and add new ones if needed. Does not remove no longer needed ones (to prevent links breaking).'
+    desc 'Resize original images based on current IMAGE_SIZES and add new ones if needed. Does not remove no longer needed ones (to prevent links breaking). By default image files that match new sizes will be skipped. If you need new versions recreated even if there is an existing file that matches the size, use FORCE_RESIZE=true.'
     task :resize_images =&gt; :environment do
       @logger = Logger.new(RAILS_ROOT + &quot;/log/resize_images_#{Time.now.strftime('%Y-%m-%d_%H:%M:%S')}.log&quot;)
 
       puts &quot;Resizing/created images based on IMAGE_SIZES...&quot;
       @logger.info &quot;Starting image file resizing.&quot;
 
+      force_resize = (ENV['FORCE_RESIZE'] &amp;&amp; ENV['FORCE_RESIZE'] == &quot;true&quot;) ? true : false
+      if force_resize
+        puts &quot;All image sizes will be recreated from originals, even if the same size image file already exists.&quot;
+        @logger.info &quot;FORCE_RESIZE=true&quot;
+      end
+
       # get a list of thumbnail keys
       image_size_keys = IMAGE_SIZES.keys
 
@@ -92,7 +98,7 @@ namespace :kete do
           missing_image_size_keys = missing_image_size_keys - [child_image_file.thumbnail.to_sym]
 
           # if this image doesn't need to be changed, skip it
-          if image_file_match_image_size?(child_image_file)
+          if image_file_match_image_size?(child_image_file) &amp;&amp; !force_resize
             @logger.info &quot;      Child image #{child_image_file.id} does not need resizing&quot;
             next
           end</diff>
      <filename>lib/tasks/tools.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f17f03c71c9d08f74e4815cc5949d24f8e5ef661</id>
    </parent>
  </parents>
  <author>
    <name>Walter McGinnis</name>
    <email>walter@katipo.co.nz</email>
  </author>
  <url>http://github.com/kete/kete/commit/b420ee21a479985a3be090eda42b7abd7430d0f7</url>
  <id>b420ee21a479985a3be090eda42b7abd7430d0f7</id>
  <committed-date>2009-11-05T16:23:44-08:00</committed-date>
  <authored-date>2009-11-05T16:23:44-08:00</authored-date>
  <message>Added ability to turn off stripping of embedded metadata from resized versions of images. Also added a force_resize option which doesn't skipped images of matching size to existing files to the kete:tools:resize_images task.</message>
  <tree>cc28b2c1ee60024b1409d5c392a3f965265808e2</tree>
  <committer>
    <name>Walter McGinnis</name>
    <email>walter@katipo.co.nz</email>
  </committer>
</commit>
