crimagify 0.0.3.8 → 0.0.3.9

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.
@@ -79,40 +79,76 @@ module Crimagify
79
79
 
80
80
  save_parent_values["#{object.class.name.underscore}_id"] = object.id
81
81
  parent_class = parent.constantize
82
- save_parent = parent_class.find(parent_id)
83
-
84
- if save_parent.update_attributes(save_parent_values)
85
- if id_array != []
86
- id_array.map { |image_name|
87
- path = value["image_temporal_#{image_name}"]
88
- if path.to_s != "" && File.exist?(path.to_s)
89
- image = save_parent.crimagify_images.where("image_name=?", image_name)
90
- if image != []
91
- image.map { |img|
92
- img.update_attributes(:image => File.open(path.to_s),
93
- :crop_x => value["#{image_name}_crop_x"],
94
- :crop_y => value["#{image_name}_crop_y"],
95
- :crop_w => value["#{image_name}_crop_w"],
96
- :crop_h => value["#{image_name}_crop_h"])
82
+ if parent_id = ''
83
+ save_parent = parent_class.new(save_parent_values)
84
+ if save_parent.save
85
+ if id_array != []
86
+ id_array.map { |image_name|
87
+ path = value["image_temporal_#{image_name}"]
88
+ if path.to_s != "" && File.exist?(path.to_s)
89
+ image = save_parent.crimagify_images.where("image_name=?", image_name)
90
+ if image != []
91
+ image.map { |img|
92
+ img.update_attributes(:image => File.open(path.to_s),
93
+ :crop_x => value["#{image_name}_crop_x"],
94
+ :crop_y => value["#{image_name}_crop_y"],
95
+ :crop_w => value["#{image_name}_crop_w"],
96
+ :crop_h => value["#{image_name}_crop_h"])
97
+ img.crop_avatar_real
98
+ }
99
+ else
100
+ img = save_new_image(path,
101
+ value["#{image_name}_crop_x"],
102
+ value["#{image_name}_crop_y"],
103
+ value["#{image_name}_crop_w"],
104
+ value["#{image_name}_crop_h"],
105
+ save_parent.class.name,
106
+ save_parent.id,
107
+ image_name,
108
+ false)
109
+ img.save!
97
110
  img.crop_avatar_real
98
- }
99
- else
100
- img = save_new_image(path,
101
- value["#{image_name}_crop_x"],
102
- value["#{image_name}_crop_y"],
103
- value["#{image_name}_crop_w"],
104
- value["#{image_name}_crop_h"],
105
- save_parent.class.name,
106
- save_parent.id,
107
- image_name,
108
- false)
109
- img.save!
110
- img.crop_avatar_real
111
+ end
111
112
  end
112
- end
113
- }
114
- end
113
+ }
114
+ end
115
+ end
116
+ else
117
+ save_parent = parent_class.find(parent_id)
118
+ if save_parent.update_attributes(save_parent_values)
119
+ if id_array != []
120
+ id_array.map { |image_name|
121
+ path = value["image_temporal_#{image_name}"]
122
+ if path.to_s != "" && File.exist?(path.to_s)
123
+ image = save_parent.crimagify_images.where("image_name=?", image_name)
124
+ if image != []
125
+ image.map { |img|
126
+ img.update_attributes(:image => File.open(path.to_s),
127
+ :crop_x => value["#{image_name}_crop_x"],
128
+ :crop_y => value["#{image_name}_crop_y"],
129
+ :crop_w => value["#{image_name}_crop_w"],
130
+ :crop_h => value["#{image_name}_crop_h"])
131
+ img.crop_avatar_real
132
+ }
133
+ else
134
+ img = save_new_image(path,
135
+ value["#{image_name}_crop_x"],
136
+ value["#{image_name}_crop_y"],
137
+ value["#{image_name}_crop_w"],
138
+ value["#{image_name}_crop_h"],
139
+ save_parent.class.name,
140
+ save_parent.id,
141
+ image_name,
142
+ false)
143
+ img.save!
144
+ img.crop_avatar_real
145
+ end
146
+ end
147
+ }
148
+ end
149
+ end
115
150
  end
151
+
116
152
  end
117
153
  else
118
154
  if params[:id_images] != ""
@@ -1,3 +1,3 @@
1
1
  module Crimagify
2
- VERSION = "0.0.3.8"
2
+ VERSION = "0.0.3.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crimagify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.8
4
+ version: 0.0.3.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-07 00:00:00.000000000 Z
12
+ date: 2013-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  version: '0'
238
238
  requirements: []
239
239
  rubyforge_project:
240
- rubygems_version: 1.8.24
240
+ rubygems_version: 1.8.23
241
241
  signing_key:
242
242
  specification_version: 3
243
243
  summary: Manage your model images with RMagick and CarrierWave