<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -38,21 +38,24 @@ module HasImage
     #
     # * :resize_to =&gt; &quot;200x200&quot;,
     # * :thumbnails =&gt; {},
+    # * :auto_generate_thumbnails =&gt; true,
+    # * :delete =&gt; true,
     # * :max_size =&gt; 12.megabytes,
     # * :min_size =&gt; 4.kilobytes,
-    # * :path_prefix =&gt; klass.to_s.tableize,
+    # * :path_prefix =&gt; klass.table_name,
     # * :base_path =&gt; File.join(RAILS_ROOT, 'public'),
     # * :column =&gt; :has_image_file,
     # * :convert_to =&gt; &quot;JPEG&quot;,
     # * :output_quality =&gt; &quot;85&quot;,
     # * :invalid_image_message =&gt; &quot;Can't process the image.&quot;,
     # * :image_too_small_message =&gt; &quot;The image is too small.&quot;,
-    # * :image_too_big_message =&gt; &quot;The image is too big.&quot;,
+    # * :image_too_big_message =&gt; &quot;The image is too big.&quot;
     def default_options_for(klass)
       {
         :resize_to =&gt; &quot;200x200&quot;,
         :thumbnails =&gt; {},
         :auto_generate_thumbnails =&gt; true,
+        :delete =&gt; true,
         :max_size =&gt; 12.megabytes,
         :min_size =&gt; 4.kilobytes,
         :path_prefix =&gt; klass.table_name,
@@ -75,17 +78,19 @@ module HasImage
     # The different setting options are described below.
     # 
     # Options:
-    # *  &lt;tt&gt;:resize_to&lt;/tt&gt; - Dimensions to resize to. This should be an ImageMagick {geometry string}[http://www.imagemagick.org/script/command-line-options.php#resize]. Fixed sizes are recommended.
-    # *  &lt;tt&gt;:thumbnails&lt;/tt&gt; - A hash of thumbnail names and dimensions. The dimensions should be ImageMagick {geometry strings}[http://www.imagemagick.org/script/command-line-options.php#resize]. Fixed sized are recommended.
-    # *  &lt;tt&gt;:min_size&lt;/tt&gt; - Minimum file size allowed. It's recommended that you set this size in kilobytes.
-    # *  &lt;tt&gt;:max_size&lt;/tt&gt; - Maximum file size allowed. It's recommended that you set this size in megabytes.
-    # *  &lt;tt&gt;:base_path&lt;/tt&gt; - Where to install the images. You should probably leave this alone, except for tests.
-    # *  &lt;tt&gt;:path_prefix&lt;/tt&gt; - Where to install the images, relative to basepath. You should probably leave this alone.
-    # *  &lt;tt&gt;:convert_to&lt;/tt&gt; - An ImageMagick format to convert images to. Recommended formats: JPEG, PNG, GIF.
-    # *  &lt;tt&gt;:output_quality&lt;/tt&gt; - Image output quality passed to ImageMagick.
-    # *  &lt;tt&gt;:invalid_image_message&lt;/tt&gt; - The message that will be shown when the image data can't be processed.
-    # *  &lt;tt&gt;:image_too_small_message&lt;/tt&gt; - The message that will be shown when the image file is too small. You should ideally set this to something that tells the user what the minimum is.
-    # *  &lt;tt&gt;:image_too_big_message&lt;/tt&gt; - The message that will be shown when the image file is too big. You should ideally set this to something that tells the user what the maximum is.
+    # *  +:resize_to+ - Dimensions to resize to. This should be an aImageMagick {geometry string}[http://www.imagemagick.org/script/command-line-options.php#resize]. Fixed sizes are recommended.
+    # *  +:thumbnails&lt;/tt&gt; - A hash of thumbnail names and dimensions. The dimensions should be ImageMagick {geometry strings}[http://www.imagemagick.org/script/command-line-options.php#resize]. Fixed sized are recommended.
+    # *  +:auto_generate_thumbnails+ - Flag to indicate whether to automatically generate thumbnails when the image_data changes (e.g. on create). If you set this to false, your application code needs to take care of generating Thumbnails, e.g. using +#generate_thumbnail+
+    # *  +:delete+ - Flag to indicate if the images should be delete from the storage (e.g. the Filesystem) when the record is destroyed
+    # *  +:min_size&lt;/tt&gt; - Minimum file size allowed. It's recommended that you set this size in kilobytes.
+    # *  +:max_size&lt;/tt&gt; - Maximum file size allowed. It's recommended that you set this size in megabytes.
+    # *  +:base_path&lt;/tt&gt; - Where to install the images. You should probably leave this alone, except for tests.
+    # *  +:path_prefix&lt;/tt&gt; - Where to install the images, relative to basepath. You should probably leave this alone.
+    # *  +:convert_to&lt;/tt&gt; - An ImageMagick format to convert images to. Recommended formats: JPEG, PNG, GIF.
+    # *  +:output_quality&lt;/tt&gt; - Image output quality passed to ImageMagick.
+    # *  +:invalid_image_message&lt;/tt&gt; - The message that will be shown when the image data can't be processed.
+    # *  +:image_too_small_message&lt;/tt&gt; - The message that will be shown when the image file is too small. You should ideally set this to something that tells the user what the minimum is.
+    # *  +:image_too_big_message&lt;/tt&gt; - The message that will be shown when the image file is too big. You should ideally set this to something that tells the user what the maximum is.
     #
     # Examples:
     #   has_image # uses all default options
@@ -183,7 +188,7 @@ module HasImage
     
     # Deletes the image from the storage.
     def remove_images
-      return if send(has_image_options[:column]).blank?
+      return if send(has_image_options[:column]).blank? || !has_image_options[:delete]
       self.class.transaction do
         begin
           storage.remove_images(self, send(has_image_options[:column]))</diff>
      <filename>lib/has_image.rb</filename>
    </modified>
    <modified>
      <diff>@@ -96,6 +96,13 @@ class PicTest &lt; Test::Unit::TestCase
     @pic.save!
     assert @pic.destroy
   end
+  
+  def test_destroy_should_not_remove_image_file_if_option_is_set
+    Pic.has_image_options[:delete] = false
+    @pic = Pic.create!(:image_data =&gt; fixture_file_upload(&quot;/image.jpg&quot;, &quot;image/jpeg&quot;))
+    @pic.destroy
+    assert File.exist?(@pic.absolute_path)
+  end
 
   def test_destroy_model_with_images_already_deleted_from_filesystem
     @pic = Pic.new</diff>
      <filename>test_rails/pic_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>69c169cab758cafb2b8e5a430487cb578338ff2d</id>
    </parent>
  </parents>
  <author>
    <name>Gerrit Kaiser</name>
    <email>gerrit@gerritkaiser.de</email>
  </author>
  <url>http://github.com/norman/has_image/commit/cb5ffb6f02bc7d7439b2e195a88c9851f93812ec</url>
  <id>cb5ffb6f02bc7d7439b2e195a88c9851f93812ec</id>
  <committed-date>2008-10-22T01:08:33-07:00</committed-date>
  <authored-date>2008-10-22T01:08:33-07:00</authored-date>
  <message>added option to not delete image files on destroy
updated option documentation</message>
  <tree>5cf94cf4942f809b6fb6251f9c966073198de241</tree>
  <committer>
    <name>Gerrit Kaiser</name>
    <email>gerrit@gerritkaiser.de</email>
  </committer>
</commit>
