objective c - TransloadIt image upload issue when image is too small in size in ios -
while uploading image of small size e.g when crop image transloadit server reply response.
{"error":"file_filter_declined_file","message":"one of files declined","reason":"file_0"}
i tried testing response adding step in assembly force_accept parameter considering(hoping) accept file size. still getting same response.
here code snippet :
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 file uploaded 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 step assembly [assembly addstepname:@"thumb" step:step]; //invoke assembly, , wait 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 }
if can me. :)
this error can surface if use file/filter robot restrict files can uploaded. while don't see using in code, might used inside saved template instructions you're referencing transloadit_template_id
Comments
Post a Comment