我在 Autodesk Forge 中创建了一个照片场景。现在我正在尝试使用此 PHP 代码将文件上传到它,但我的上传失败了。您可以检查图像的 url 是否存在在线,是否为 jpg,并且应该可以被 Forge 接受。(我也尝试将它们作为本地文件上传并收到相同的错误消息)。
是什么阻止了 Forge 接受我的图像,我该如何解决?
foreach( $files_for_forge as $url )
{
$curl_cmd =
"curl -s $FORGE_URL/photo-to-3d/v1/file " .
"-H 'Authorization: Bearer $access_token' " .
"-d 'photosceneid=$photosceneID' " .
"-d 'type=image' " .
"-d 'file[$filecounter]=$url' "
;
$json = shell_exec ( $curl_cmd );
echo "File $filecounter: $url => $json<br />";
$filecounter++;
}
结果输出显示每次文件上传尝试都失败并出现以下错误:“错误”:{“代码”:“18”,“msg”:“指定的图像协议无效”}
File 0: cloud1.tri-di.com/scans/D-A000-5d008f27/original_images/img-13.jpg => {"Usage":"0.67387795448303","Resource":"\/file","Error":{"code":"18","msg":"Specified image protocol is invalid"}}
File 1: cloud1.tri-di.com/scans/D-A000-5d008f27/original_images/img-22.jpg => {"Usage":"0.70915198326111","Resource":"\/file","Error":{"code":"18","msg":"Specified image protocol is invalid"}}
File 2: cloud1.tri-di.com/scans/D-A000-5d008f27/original_images/img-12.jpg => {"Usage":"0.76431202888489","Resource":"\/file","Error":{"code":"18","msg":"Specified image protocol is invalid"}}
...
File 18: cloud1.tri-di.com/scans/D-A000-5d008f27/original_images/img-20.jpg => {"Usage":"0.74234795570374","Resource":"\/file","Error":{"code":"18","msg":"Specified image protocol is invalid"}}
File 19: cloud1.tri-di.com/scans/D-A000-5d008f27/original_images/img-23.jpg => {"Usage":"0.73936891555786","Resource":"\/file","Error":{"code":"18","msg":"Specified image protocol is invalid"}}
我用这个 API 调用检查了照片场景的状态:
curl -s https://developer.api.autodesk.com/photo-to-3d/v1/photoscene/KIpe815PrmsCr1Wp73gMFcXQs9wD27P1n1OLiBNfALU/properties
它返回有关我的照片场景的以下信息,显示没有附加文件:
{
"Usage":"0.70800614356995",
"Resource":"\/photoscene\/KIpe815PrmsCr1Wp73gMFcXQs9wD27P1n1OLiBNfALU\/properties",
"next_token":{},
"Photoscenes":{
"Photoscene:{
"photosceneid":"KIpe815PrmsCr1Wp73gMFcXQs9wD27P1n1OLiBNfALU",
"itemName":"KIpe815PrmsCr1Wp73gMFcXQs9wD27P1n1OLiBNfALU",
"clientID":"HAqDtKO7VbuRgH0nL0MFJ0B02ElBEK3l",
"clientStatus":"CREATED",
"type":"all",
"userID":"DtX37KrG1KKBKOHbphoDMzRfn0k=",
"convertStatus":"CREATED",
"projectID":"KIpe815PrmsCr1Wp73gMFcXQs9wD27P1n1OLiBNfALU",
"engineVersion":"3.0.0.3104",
"convertFormat":"rcm,obj,fbx",
"userAgent":"PF_APIv3.2.473-Photofly-WebAPI-FORGE",
"creationDate":"2019-06-26T22:06:23",
"name":"sonautics-D-A000-5d008f27-20190626150712",
"maxResolutionForImage":"100000000",
"UseTitanTextureEngine":"1",
"scenetype":"object",
"status":"PROCESSING",
"Files":{}
}
}
}