Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

Commit

Permalink
Fixed export model images for 'images.sorted.first'
Browse files Browse the repository at this point in the history
  • Loading branch information
shakeelanjum committed Mar 17, 2015
1 parent f64ca97 commit 59e8f67
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/tasks/export_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ task :export_model_images, [:vendorname] => :environment do |t, args|

if m.images.count > 0
### no need if separately done
m.images.sorted.first.file.reprocess!
first_image = m.images.sorted.first
first_image.file.reprocess!

dirpath = path + "#{vendorslug}"
if !Dir.exists?(dirpath)
Expand All @@ -109,10 +110,10 @@ task :export_model_images, [:vendorname] => :environment do |t, args|
Dir.mkdir(dirpath)
end
begin
m.images.sorted.first.file.copy_to_local_file(:icon, path + iconfilepath)
m.images.sorted.first.file.copy_to_local_file(:thumbnail, path + thumbfilepath)
m.images.sorted.first.file.copy_to_local_file(:original, path + originalfilepath)
puts " - Image downloaded (" + m.images.sorted.first.file.url + ")"
first_image.file.copy_to_local_file(:icon, path + iconfilepath)
first_image.file.copy_to_local_file(:thumbnail, path + thumbfilepath)
first_image.file.copy_to_local_file(:original, path + originalfilepath)
puts " - Image downloaded (" + first_image.file.url + ")"

assets_bucket.objects.create(iconfilepath, Pathname.new(path + iconfilepath))
assets_bucket.objects.create(thumbfilepath, Pathname.new(path + thumbfilepath))
Expand Down

0 comments on commit 59e8f67

Please sign in to comment.