bingo: strip photo metadata, identify to Wikimedia
Photos are served byte-for-byte, and the Commons shot of Medvedkovo carries GPS coordinates in its EXIF, while the card is meant to stay city-level. Drop Exif/XMP/IPTC/comment segments from JPEG, text/eXIf chunks from PNG and EXIF/XMP chunks from WebP on store; pixel data is left alone and malformed files are rejected. upload.wikimedia.org answered 429 to the generic agent; its policy asks for a tool name and contact, so send one. Add a "re-import all" admin action so photos stored before this change get re-fetched and stripped. Assisted-by: Claude:opus-5
This commit is contained in:
parent
7820f138f6
commit
903dc17a75
4 changed files with 105 additions and 4 deletions
|
|
@ -87,10 +87,13 @@ module BingoAdmin
|
|||
redirect "/admin/bingo/dc/#{dc.id}"
|
||||
end
|
||||
|
||||
# Bulk: import every missing photo from its photo_source_url.
|
||||
# Bulk: import every missing photo from its photo_source_url, or with
|
||||
# all=1 re-import every photo that has a source URL.
|
||||
app.post '/admin/bingo/photos/import' do
|
||||
ok, failed = 0, []
|
||||
Bingo::Datacenter.where(photo_key: nil).exclude(photo_source_url: nil).each do |dc|
|
||||
scope = Bingo::Datacenter.exclude(photo_source_url: nil)
|
||||
scope = scope.where(photo_key: nil) unless params[:all] == '1'
|
||||
scope.each do |dc|
|
||||
dc.update(photo_key: Bingo::Photo.store(dc.slug, Bingo::Photo.fetch(dc.photo_source_url)))
|
||||
ok += 1
|
||||
rescue Bingo::Photo::Error => e
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue