mirror of
https://github.com/neocities/neocities.git
synced 2025-08-02 15:51:55 +02:00
mostly finished port to ruby3
This commit is contained in:
parent
a9dd102383
commit
0ca1473d22
30 changed files with 765 additions and 731 deletions
|
@ -50,14 +50,14 @@ class ScreenshotWorker
|
|||
return false
|
||||
end
|
||||
|
||||
img_list.new_image(img_list.first.columns, img_list.first.rows) { self.background_color = "white" }
|
||||
img_list.new_image(img_list.first.columns, img_list.first.rows) {|i| i.background_color = "white" }
|
||||
img = img_list.reverse.flatten_images
|
||||
img_list.destroy!
|
||||
|
||||
user_screenshots_path = File.join SCREENSHOTS_PATH, Site.sharding_dir(username), username
|
||||
screenshot_path = File.join user_screenshots_path, File.dirname(path)
|
||||
|
||||
FileUtils.mkdir_p screenshot_path unless Dir.exists?(screenshot_path)
|
||||
FileUtils.mkdir_p screenshot_path unless Dir.exist?(screenshot_path)
|
||||
|
||||
Site::SCREENSHOT_RESOLUTIONS.each do |res|
|
||||
width, height = res.split('x').collect {|r| r.to_i}
|
||||
|
@ -72,7 +72,7 @@ class ScreenshotWorker
|
|||
tmpfile_path = "/tmp/#{SecureRandom.uuid}.jpg"
|
||||
|
||||
begin
|
||||
new_img.write(tmpfile_path) { self.quality = 92 }
|
||||
new_img.write(tmpfile_path) { |i| i.quality = 92 }
|
||||
new_img.destroy!
|
||||
$image_optim.optimize_image! tmpfile_path
|
||||
File.open(full_screenshot_path, 'wb') {|file| file.write File.read(tmpfile_path)}
|
||||
|
|
|
@ -43,8 +43,8 @@ class ThumbnailWorker
|
|||
|
||||
full_thumbnail_path = File.join(user_thumbnails_path, "#{path}.#{res}.#{save_ext}")
|
||||
|
||||
resimg.write(full_thumbnail_path) {
|
||||
self.quality = 75
|
||||
resimg.write(full_thumbnail_path) { |i|
|
||||
i.quality = 75
|
||||
}
|
||||
resimg.destroy!
|
||||
#$image_optim.optimize_image! full_thumbnail_path
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue