class DatoDump::FieldTypeDumper::Image

Public Class Methods

dump(value, _repo) click to toggle source
# File lib/dato_dump/field_type_dumper/image.rb, line 5
def self.dump(value, _repo)
  if value
    url = Imgix::Client.new(
      host: 'dato-images.imgix.net',
      secure: true
    )
      .path(value[:path])
      .ch('DPR', 'Width')
      .auto('compress', 'format')
      .to_url

    {
      format: value[:format],
      size: value[:size],
      width: value[:width],
      height: value[:height],
      url: url
    }
  end
end