PERF: skip optimizing large letter avatar makes image bigger
This commit is contained in:
parent
38cb72b329
commit
90ad943dd3
|
@ -45,6 +45,9 @@ class LetterAvatar
|
||||||
fullsize = fullsize_path(identity)
|
fullsize = fullsize_path(identity)
|
||||||
generate_fullsize(identity) if !cache || !File.exists?(fullsize)
|
generate_fullsize(identity) if !cache || !File.exists?(fullsize)
|
||||||
|
|
||||||
|
# Optimizing here is dubious, it can save up to 2x for large images (eg 359px)
|
||||||
|
# BUT... we are talking 2400 bytes down to 1200 bytes, both fit in one packet
|
||||||
|
# The cost of this is huge, its a 40% perf hit
|
||||||
OptimizedImage.resize(fullsize, filename, size, size)
|
OptimizedImage.resize(fullsize, filename, size, size)
|
||||||
|
|
||||||
filename
|
filename
|
||||||
|
@ -81,8 +84,7 @@ class LetterAvatar
|
||||||
|
|
||||||
`convert #{instructions.join(" ")}`
|
`convert #{instructions.join(" ")}`
|
||||||
|
|
||||||
ImageOptim.new.optimize_image!(filename) rescue nil
|
## do not optimize image, it will end up larger than original
|
||||||
|
|
||||||
filename
|
filename
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue