Minify home images

This commit is contained in:
Daniel Nitsikopoulos
2024-09-17 21:51:39 +10:00
parent 2a2d3ae9d1
commit 4b5f10cd22
3 changed files with 11 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ require "rexml/parsers/pullparser"
require "sanitize"
require "nokogiri"
require "unicode/emoji"
require "mini_magick"
module Main
module Decorators
@@ -32,6 +33,12 @@ module Main
__getobj__.photos.select { |p| !p["value"].end_with?("mp4") }
end
def photo_thumbnails
photos.map do |photo|
photo["value"] = photo["value"].gsub(".jpeg", "-small.jpeg")
end
end
def videos?
__getobj__.photos.count { |p| p["value"].end_with?("mp4") } > 0
end