mirror of
https://github.com/neocities/neocities.git
synced 2025-08-04 16:51:36 +02:00
add opengraph / link expander friendly screenshot, add image optimizers
This commit is contained in:
parent
3c62b7be22
commit
c3789564f0
3 changed files with 10 additions and 0 deletions
|
@ -54,8 +54,15 @@ class ScreenshotWorker
|
|||
screenshot_path = File.join user_screenshots_path, File.dirname(path_for_screenshot)
|
||||
FileUtils.mkdir_p screenshot_path unless Dir.exist?(screenshot_path)
|
||||
|
||||
ImageOptimizer.new(base_image_tmpfile_path, level: 1).optimize
|
||||
FileUtils.cp base_image_tmpfile_path, File.join(user_screenshots_path, "#{path_for_screenshot}.png")
|
||||
|
||||
# Optimized for open graph link expanders
|
||||
image = Rszr::Image.load base_image_tmpfile_path
|
||||
image.resize! 1200, 630, crop: :n
|
||||
image.save File.join(user_screenshots_path, "#{path_for_screenshot}.jpg"), quality: 85
|
||||
ImageOptimizer.new(File.join(user_screenshots_path, "#{path_for_screenshot}.jpg")).optimize
|
||||
|
||||
Site::SCREENSHOT_RESOLUTIONS.each do |res|
|
||||
width, height = res.split('x').collect {|r| r.to_i}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue