discourse/app/jobs/onceoff/clear_width_and_height.rb
Sam 9ab1fb7dfc FEATURE: correctly store width and height on uploads
Previously we used width and height for thumbnails, new code ensures

1. We auto correct width and height
2. We added extra columns for thumbnail_width and height, this is determined
 by actual upload and no longer passed in as a side effect
3. Optimized Image now stores filesize which can be used for analysis, decisions

Also

- fixes Android image manifest as a side effect
- fixes issue where a thumbnail generated that is smaller than the upload is no longer used
2018-08-28 12:59:22 +10:00

16 lines
433 B
Ruby

module Jobs
class ClearWidthAndHeight < Jobs::Onceoff
def execute_onceoff(args)
# we have to clear all old uploads cause
# we could have old versions of height / width
# this column used to store thumbnail size instead of
# actual size
DB.exec(<<~SQL)
UPDATE uploads
SET width = null, height = null
WHERE width IS NOT NULL OR height IS NOT NULL
SQL
end
end
end