Skip to content

Commit

Permalink
Adds thumbnail image.
Browse files Browse the repository at this point in the history
Refactors artwork processing to include images.
  • Loading branch information
picandocodigo committed May 7, 2012
1 parent 31053be commit 02285d1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
11 changes: 11 additions & 0 deletions db/migrate/20120507202428_add_thumbnail_image_to_artwork.rb
@@ -0,0 +1,11 @@
class AddThumbnailImageToArtwork < ActiveRecord::Migration
def change
add_column :artworks, :image_thumbnail_url, :string
Artwork.all.each do |artwork|
artwork.update_attributes!(
:image_thumbnail_url =>
"http://www.mnav.gub.uy/obras/mnav#{artwork.museum_id}.jpg"
)
end
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20120503193941) do
ActiveRecord::Schema.define(:version => 20120507202428) do

create_table "artists", :force => true do |t|
t.integer "museum_id"
Expand All @@ -37,6 +37,7 @@
t.datetime "updated_at"
t.integer "year"
t.string "image_url"
t.string "image_thumbnail_url"
end

end
4 changes: 2 additions & 2 deletions lib/data/data.yaml
Expand Up @@ -2,8 +2,8 @@
artists:
url: http://www.mnav.gub.uy/artistas.csv
name: artists.csv
last_modified: 2012/05/02
last_modified: 2012/05/07
artworks:
url: http://www.mnav.gub.uy/obras.csv
name: artworks.csv
last_modified: 2012/05/02
last_modified: 2012/05/07
4 changes: 3 additions & 1 deletion lib/data/process_data.rb
Expand Up @@ -62,7 +62,9 @@ def self.process_artworks(file)
:technique => row[4],
:height => row[5],
:width => row[6],
:depth => row[7]
:depth => row[7],
:image_url => "http://www.mnav.gub.uy/obras/mnavXX#{row[0]}.jpg",
:image_thumbnail_url => "http://www.mnav.gub.uy/obras/mnav#{row[0]}.jpg"
}
create_artwork(artwork_data)
end
Expand Down

0 comments on commit 02285d1

Please sign in to comment.