根据 json 表示无限地存储上传的图像
Store uploaded images tdefinitely based on their json representation
大家好,自从过去一个小时以来,我一直在尝试使用 minimagick gem,但我不明白为什么我无法打开图像。 return 值始终为 null
我的控制器中有以下代码:
class UploadController < ApplicationController
require 'mini_magick'
def load
file = "public/uploads/cache/img.jpg"
image = MiniMagick::Image.open(file)
render json: image
end
end
开始上传#load
我得到一个空值。
我已经使用自制软件在我的 mac 上安装了 minimagick。
我重新启动了服务器。
谢谢!
您正在渲染 local variable
"image"
而不是 instance variable
"@image"
def load
file = "public/uploads/cache/img.jpg"
@image = MiniMagick::Image.open(file)
render json: @image
end
大家好,自从过去一个小时以来,我一直在尝试使用 minimagick gem,但我不明白为什么我无法打开图像。 return 值始终为 null
我的控制器中有以下代码:
class UploadController < ApplicationController
require 'mini_magick'
def load
file = "public/uploads/cache/img.jpg"
image = MiniMagick::Image.open(file)
render json: image
end
end
开始上传#load 我得到一个空值。
我已经使用自制软件在我的 mac 上安装了 minimagick。 我重新启动了服务器。
谢谢!
您正在渲染 local variable
"image"
而不是 instance variable
"@image"
def load
file = "public/uploads/cache/img.jpg"
@image = MiniMagick::Image.open(file)
render json: @image
end