Class: ImageUpscaleWorker
- Inherits:
-
Object
- Object
- ImageUpscaleWorker
- Includes:
- Sidekiq::Worker, Workers::StatusBroadcastable
- Defined in:
- app/workers/image_upscale_worker.rb
Overview
Background worker for upscaling images using ImageKit or Topaz Labs AI.
Supports two upscaling engines:
- ImageKit (default) - Fast, built-in e-upscale transformation
- Topaz Labs Gigapixel - Industry-leading quality with specialized models
This worker:
- Downloads/processes the upscaled version via selected engine
- Validates the result is a valid image
- Uploads it as a new image or replaces the original
- Updates the Image record with new dimensions/size
- Purges the ImageKit cache
- Tags the image appropriately
Constant Summary collapse
- MIN_VALID_FILE_SIZE =
Minimum file size for a valid image (must be larger than this)
1000- ENGINES =
Supported upscaling engines
%w[imagekit topaz].freeze
- ENGINE_TAGS =
Tag applied for each engine
{ 'imagekit' => 'imagekit-upscaled', 'topaz' => 'topaz-upscaled' }.freeze
Instance Attribute Summary
Attributes included from Workers::StatusBroadcastable
Instance Method Summary collapse
Methods included from Workers::StatusBroadcastable::Overrides
Instance Method Details
#perform(image_id = nil, options = {}) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'app/workers/image_upscale_worker.rb', line 58 def perform(image_id = nil, = {}) = .with_indifferent_access if [:batch] || image_id.nil? batch_enqueue() else process_image(image_id, ) end end |