From 5b951f012e04e6ef97e4ef645d53bdf433a9eb7f Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 21 Jul 2026 21:02:16 +0200 Subject: Implement model side of PDF raster preview generation --- lib/tasks/assets.rake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index 9d4b048..e778021 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -1,7 +1,9 @@ namespace :assets do desc "Regenerate ImageMagick variants for every image asset from its stored original -- rerun whenever a new style is added to FileAttachment::STYLES after assets already exist. Scope to one asset first with ASSET_ID=123." task :regenerate_variants => :environment do - scope = Asset.images + scope = Asset.where(upload_content_type: FileAttachment::IMAGE_CONTENT_TYPES + + FileAttachment::VECTOR_CONTENT_TYPES + + FileAttachment::RASTERIZED_CONTENT_TYPES) scope = scope.where(id: ENV["ASSET_ID"]) if ENV["ASSET_ID"].present? scope.find_each do |asset| @@ -12,7 +14,7 @@ namespace :assets do next end - asset.send(:generate_variants, original_path) + asset.send(:generate_all_variants, original_path) puts "Regenerated variants for Asset##{asset.id} (#{asset.name})" end end -- cgit v1.3