Class: BannerImageBatchWorker
- Inherits:
-
Object
- Object
- BannerImageBatchWorker
- Includes:
- Sidekiq::Worker, Workers::StatusBroadcastable
- Defined in:
- app/workers/banner_image_batch_worker.rb
Overview
Batch worker that enqueues AI image generation jobs for landing page banners
and OG images. Uses the existing +ImageGenerationWorker+ pipeline so each
generated image goes through the normal staging → review → import flow.
Two modes of operation:
- No arguments (bulk): find every Image that carries a +banner-for-*+ tag,
then enqueue banner and/or OG generation jobs for each. - With +page_id+ (single): enqueue generation jobs for one specific page.
At import time +promote_to_image+ handles the exclusive-tag swap automatically
(removes the tag from the old image and assigns it to the new one).
Constant Summary collapse
- BANNER_PROMPT =
<<~PROMPT.squish Create a high-quality photorealistic variation of this image, preserving the same subject, setting, and mood. The variation should look natural and professional, suitable as a landing page hero banner for a radiant floor heating company. Ensure that a generous portion of the floor surface is clearly visible in the composition — the flooring material (tile, stone, hardwood, concrete, etc.) should be a prominent visual element, not cropped out or obscured by furniture. PROMPT
- OG_PROMPT =
<<~PROMPT.squish Create a high-quality photorealistic variation of this image, preserving the same subject, setting, and mood. The image must be visually compelling at small thumbnail sizes for social media sharing. Use bold composition, vivid colours, and a clear focal point. This is for a radiant floor heating company — make sure the floor surface is clearly visible and prominent in the frame, showcasing the flooring material (tile, stone, hardwood, concrete, etc.). PROMPT
Instance Attribute Summary
Attributes included from Workers::StatusBroadcastable
Instance Method Summary collapse
Methods included from Workers::StatusBroadcastable::Overrides
Instance Method Details
#perform(page_id = nil, options = {}) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'app/workers/banner_image_batch_worker.rb', line 58 def perform(page_id = nil, = {}) opts = .with_indifferent_access if page_id.nil? bulk_enqueue(opts) else enqueue_for_page(page_id, opts) end end |