attachment_on_the_fly 0.0.1 → 0.0.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{attachment_on_the_fly}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Sutherland"]
12
- s.date = %q{2009-10-16}
12
+ s.date = %q{2009-10-21}
13
13
  s.description = %q{A Paperclip mix-in to allow auto-generation of resized images}
14
14
  s.email = %q{jefferey.sutherland@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -41,6 +41,8 @@ Paperclip::Attachment.class_eval do
41
41
  # if our method string does not match, we kick things back up to super ... this keeps ActiveRecord chugging along happily
42
42
  super
43
43
  end
44
+
45
+ return image_name
44
46
  end
45
47
 
46
48
  def generate_image(kind, height = 0, width = 0)
@@ -56,12 +58,18 @@ Paperclip::Attachment.class_eval do
56
58
  end
57
59
 
58
60
  path = instance.attachment.path
61
+ url = instance.attachment.url
62
+
59
63
  path_arr = path.split("/")
60
64
  file_name = path_arr.pop
61
65
  path = path_arr.join("/")
62
66
 
67
+ url_arr = url.split("/")
68
+ url_file_name = url_arr.pop
69
+ url_path = url_arr.join("/")
70
+
63
71
  original = path + "/" + instance.attachment.original_filename
64
- newfilename = path + "/" + prefix + file_name
72
+ newfilename = url_path + "/" + prefix + file_name
65
73
 
66
74
  return newfilename if File.exist?(newfilename)
67
75
 
@@ -80,6 +88,6 @@ Paperclip::Attachment.class_eval do
80
88
  `convert -colorspace RGB -geometry #{height}x#{height} -quality 100 #{original} #{newfilename} 2>&1 > /dev/null`
81
89
  end
82
90
 
83
- newfilename
91
+ return newfilename
84
92
  end
85
93
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attachment_on_the_fly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Sutherland
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-16 00:00:00 -06:00
12
+ date: 2009-10-21 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15