mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:54:31 +08:00
9ab1fb7dfc
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
16 lines
433 B
Ruby
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
|