0

画像を pinterest スタイルのギャラリー形式でレンダリングできるように、画像のサイズをデータベースに保存する必要があります。

私はこの方法を使用していました:

def update_asset_attributes
  if image.present? && image_changed?
    ap image.file
    self.image_content_type = image.file.content_type
    self.image_file_size = image.file.size
    self.image_width, self.image_height = `identify -format "%wx%h" #{image.file.path}`.split(/x/)
  end
end

しかし今、それは言う:NoMethodError - undefined method content_type for #<Cloudinary::CarrierWave::PreloadedCloudinaryFile:0x007f9834d81840>:

4

1 に答える 1