I have created a photoscene in Autodesk Forge. Now I am now trying to upload files to it using this PHP code and my uploads are failing. You can check the urls of the images exist online, are jpgs, and should be acceptable to Forge. (I have also tried uploading them as local files and received the same error messages).
What's preventing Forge from accepting my images, and how do I fix it?
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++;
}
The resulting output shows every file upload attempt is failing with this error: "Error":{"code":"18","msg":"Specified image protocol is invalid"}
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"}}
I checked the status of the photoscene with this API call:
curl -s https://developer.api.autodesk.com/photo-to-3d/v1/photoscene/KIpe815PrmsCr1Wp73gMFcXQs9wD27P1n1OLiBNfALU/properties
and it returns the following information about my photoscene, showing no files are being attached:
{
"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":{}
}
}
}
Try again and make sure your URL starts with http
or https
.
Otherwise our server will not treat them as remote resources and proceed to download.