当iOS中的尺寸太小时,trainsloadit映像上传问题



在上传尺寸太小的图像时,例如,当我裁剪映像transloadit服务器时,请始终回复此响应。

{"error":"FILE_FILTER_DECLINED_FILE","message":"One of your files was declined","reason":"file_0"}

我还尝试了通过使用 force_accept 参数考虑(希望)将接受任何文件大小的参数来测试响应。但仍然得到相同的回应。

这是代码段:

Transloadit *transloadit = [[Transloadit alloc]init:TRANSLOADIT_API_KEY];
AssemblyBuilder *assembly = [[AssemblyBuilder alloc]init];
[assembly setTemplateID:TRANSLOADIT_TEMPLATE_ID];
NSData *imgData = UIImageJPEGRepresentation(imageToUpload, 1.0f);
NSError* error;

//Add a file to be uploaded with autogenerated key
[assembly addFile:imgData withError:error];
if(error!=nil)
    TRANSLOADIT_LOG_ERROR(self.class,error);
NSObject<IStep>* step=[[Step alloc] init];
[step setOptionKey:@"robot" object:@"/image/resize"];
[step setOptionKey:@"width" object:@(75)];
[step setOptionKey:@"height" object:@(75)];
[step setOptionKey:@"resize_strategy" object:@"pad"];
[step setOptionKey:@"background" object:@"#000000"];
[step setOptionKey:@"force_accept" object:[NSNumber numberWithBool:YES]];

//Add the step to the assembly
[assembly addStepName:@"thumb" step:step];

//Invoke assembly, and wait for the result
TransloaditResponse* response =[transloadit invokeAssembly:assembly withError:error];
if(error!=nil)
{
    TRANSLOADIT_LOG_ERROR_WITH_MESSAGE(self.class,@"Error has occured while completing assembly");
}
if([response isSuccess])
{
     // success code
}
else
{
     // failure code
}

如果有人可以帮助我。谢谢:)

只有在使用文件/过滤器机器人限制可以上传的文件时,此错误才能浮出水面。虽然我看不到您在代码中使用它,但它很可能在您通过TRANSLOADIT_TEMPLATE_ID

引用的保存模板指令中使用。

相关内容

  • 没有找到相关文章

最新更新