我一直在尝试使用paperclip将文件(RMagick处理的输出)上传到s3.我一直在收到错误
找不到http://upload.wikimedia.org/wikipedia/commons/thumb/4/48/EBay_logo.png/800px-EBay_logo.png= > 800px-EBay_logo.png的处理程序 PNG 800x349 800x349 + 0 + 0 DirectClass 8-位37kb
基本上,在我的系统中 - 用户使用外部URL上传徽标,我处理徽标并修剪空白并上传到我的s3系统.我一直在使用临时文件作为中间人,但我想直接这样做:
在我的模型中,我这样做:
def fetch_and_trim_logo
puts "logo is #{logo}"
if logo_changed?
response = RestClient.get logo
if response.code == 200
img = Magick::Image::read(logo)[0]
puts "This image is #{img.columns}x#{img.rows} pixels"
trimmed_img = img.trim
puts "Trimmed image is #{trimmed_img.columns}x#{trimmed_img.rows} pixels"
temp_file = Tempfile.new(["trimmed_image",".png"])
trimmed_img.write("png:" + temp_file.path)
my_asset = visitor.user.my_assets.new
my_asset.uploaded_file = temp_file
my_asset.save
end
end
end
Run Code Online (Sandbox Code Playgroud)
我的My_asset模型具有所有回形针设置,如下所示:
Class MyAsset<ActiveRecord::Base
---
---
has_attached_file :uploaded_file
attr_accessible :uploaded_file
validates_attachment_size :uploaded_file, :less_than=>5.megabyte …Run Code Online (Sandbox Code Playgroud) 我使用的代码如下:
const int NUMBER_OF_FIELDS = 3;
int fieldIndex = 0;
int values[NUMBER_OF_FIELDS];
void setup()
{
Serial.begin(9600);
}
void loop()
{
if(Serial.available())
{
char ch = Serial.read();
if(ch>='0' && ch <= '9')
{
values[fieldIndex] = (values[fieldIndex]*10 +(ch-'0'));
}
else if (ch == ',')
{
if(fieldIndex < NUMBER_OF_FIELDS -1)
fieldIndex++;
}
else
{
Serial.print(fieldIndex+1);
Serial.println("fields recieved:");
for (int i = 0; i<=fieldIndex; i++);
{
//Serial.println(values[i]);
//values[i]= 0;
}
fieldIndex = 0;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但我收到的错误是:
对于'范围','i'的名称查找已更改为新的ISO'
我不认为我在for循环中做错了什么,为什么我得到这个错误?