Storehouse.Analyzer.Warm (Storehouse v0.2.0)

Copy Markdown View Source

A step (Storehouse.Analyzer) that makes an image's sizes before a visitor asks for them (Storehouse.Responsive.warm/3), under "warm": for an app that runs its steps out of the request already (Storehouse.analyze_later/3), on a queue of their own.

steps = [
  Storehouse.Analyzer.Placeholder,
  {Storehouse.Analyzer.Warm, warm: [:photo], up_to: 3840}
]

Storehouse.analyze_later(file, steps,
  then: {MyApp.Photos, :analyzed, [photo.id]},
  runner: {Storehouse.Runner.Oban, queue: :media}
)

It needs no download of the original: alone, it reads nothing. Skipped when warming is off (Storehouse.Responsive.enabled?/1), and for a file that is not an image. Storehouse.Responsive.warm_later/3 does the same with no other steps.

Options