pothoven-attachment_fu 3.2.5 → 3.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ * Mar 12, 2013 *
2
+ * Pull in changes from https://github.com/aalong/attachment_fu to use Ruby 1.9.2 Tempfile naming strategy to fix conflicts with Sprockets (see https://github.com/aalong/attachment_fu/commit/938ec3b8597fbf82b1de8c98de12c4688463450a)
3
+
1
4
  * Feb 19, 2013 *
2
5
  * Pull in changes from https://github.com/itkin/attachment_fu fork to fix mini magick
3
6
 
data/README CHANGED
@@ -41,7 +41,9 @@ has_attachment(options = {})
41
41
  #
42
42
  :resize_to # Used by RMagick to resize images.
43
43
  # Pass either an array of width/height, or a geometry string.
44
+ # Note: prefixing geometry string with a 'c' will crop the image to specified size.
44
45
  #
46
+ :sharpen_on_resize # RMagick only. Sharpens image after it is resized if this is set to true.
45
47
  :thumbnails # Specifies a set of thumbnails to generate.
46
48
  # This accepts a hash of filename suffixes and RMagick resizing options.
47
49
  # This option need only be included if you want thumbnailing.
@@ -3,21 +3,10 @@ class Engine < Rails::Engine
3
3
  config.autoload_paths << File.expand_path("..", __FILE__)
4
4
 
5
5
  initializer "attachment_fu" do
6
- require 'tempfile'
7
6
  require 'geometry'
8
7
 
9
8
  ActiveRecord::Base.send(:extend, Technoweenie::AttachmentFu::ActMethods)
10
9
  Technoweenie::AttachmentFu.tempfile_path = ATTACHMENT_FU_TEMPFILE_PATH if Object.const_defined?(:ATTACHMENT_FU_TEMPFILE_PATH)
11
10
  FileUtils.mkdir_p Technoweenie::AttachmentFu.tempfile_path
12
-
13
- # overwrite so tempfiles use the extension of the basename.
14
- # important for rmagick and image science
15
- Tempfile.class_eval do
16
- def make_tmpname(basename, n)
17
- ext = nil
18
- sprintf("%s%d-%d%s", basename.to_s.gsub(/\.\w+$/) { |s| ext = s; '' }, $$, n.to_i, ext)
19
- end
20
- end
21
-
22
11
  end
23
12
  end
@@ -425,7 +425,9 @@ module Technoweenie # :nodoc:
425
425
  protected
426
426
  # Generates a unique filename for a Tempfile.
427
427
  def random_tempfile_filename
428
- "#{rand Time.now.to_i}#{filename || 'attachment'}"
428
+ base_filename = filename ? filename.gsub(/\.\w+$/, '') : 'attachment'
429
+ ext = filename.slice(/\.\w+$/)
430
+ ["#{rand Time.now.to_i}#{base_filename}", ext || '']
429
431
  end
430
432
 
431
433
  def sanitize_filename(filename)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pothoven-attachment_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.5
4
+ version: 3.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-19 00:00:00.000000000 Z
13
+ date: 2013-03-12 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: This is a fork of Rick Olson’s attachment_fu adding Ruby 1.9 and Rails
16
16
  3.2 support as well as some other enhancements.