Skip to content

Commit

Permalink
Use large iNaturalist photos in subject locations (#4360)
Browse files Browse the repository at this point in the history
* Use large iNaturalist photos in subject locations

* Missed some originals
  • Loading branch information
zwolf authored Jul 18, 2024
1 parent fc632d2 commit c01f49b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/inaturalist/observation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def locations
def extract_locations(obs)
locations = []
obs['photos'].each do |p|
url = p['url'].sub('square', 'original')
url = p['url'].sub('square', 'large')
mimetype = mime_type_from_file_extension(url)
locations << { mimetype => url }
end
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/observation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
metadata { { id: generate(:id_sequence) } }
locations {
[
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/12345/original.JPG' },
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/45678/original.JPG' }
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/12345/large.JPG' },
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/45678/large.JPG' }
]
}
initialize_with { new(**attributes) }
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/inaturalist/observation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
}
let(:obs_locations) {
[
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/12345/original.JPG' },
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/45678/original.JPG' }
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/12345/large.JPG' },
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/45678/large.JPG' }
]
}

Expand Down
4 changes: 2 additions & 2 deletions spec/lib/inaturalist/subject_importer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
let(:importer) { described_class.new(subject_set.project.owner.id, subject_set.id) }
let(:locations) {
[
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/12345/original.JPG' },
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/45678/original.JPG' }
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/12345/large.JPG' },
{ 'image/jpeg' => 'https://static.inaturalist.org/photos/45678/large.JPG' }
]
}

Expand Down

0 comments on commit c01f49b

Please sign in to comment.