From c01f49bae8a53b66c04a392791dbfdf7a495d86e Mon Sep 17 00:00:00 2001 From: Zach Wolfenbarger Date: Thu, 18 Jul 2024 10:45:36 -0500 Subject: [PATCH] Use large iNaturalist photos in subject locations (#4360) * Use large iNaturalist photos in subject locations * Missed some originals --- lib/inaturalist/observation.rb | 2 +- spec/factories/observation.rb | 4 ++-- spec/lib/inaturalist/observation_spec.rb | 4 ++-- spec/lib/inaturalist/subject_importer_spec.rb | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/inaturalist/observation.rb b/lib/inaturalist/observation.rb index 72dcb9e4d..6e47dafcb 100644 --- a/lib/inaturalist/observation.rb +++ b/lib/inaturalist/observation.rb @@ -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 diff --git a/spec/factories/observation.rb b/spec/factories/observation.rb index 5c7a59446..2158a6929 100644 --- a/spec/factories/observation.rb +++ b/spec/factories/observation.rb @@ -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) } diff --git a/spec/lib/inaturalist/observation_spec.rb b/spec/lib/inaturalist/observation_spec.rb index e9740cd9d..80e311012 100644 --- a/spec/lib/inaturalist/observation_spec.rb +++ b/spec/lib/inaturalist/observation_spec.rb @@ -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' } ] } diff --git a/spec/lib/inaturalist/subject_importer_spec.rb b/spec/lib/inaturalist/subject_importer_spec.rb index 44dee732f..6a2f9433f 100644 --- a/spec/lib/inaturalist/subject_importer_spec.rb +++ b/spec/lib/inaturalist/subject_importer_spec.rb @@ -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' } ] }