Josh Posted July 31, 2016 Posted July 31, 2016 Interesting: https://sketchfab.com/models/0e12af8c2073407cbd75fa510b8f85e2/embed 1 Quote Let's build cool stuff and have fun.
Josh Posted July 31, 2016 Author Posted July 31, 2016 I've got it sort of working. Just need to parse the JSON code to get the preview thumbnail: https://api.sketchfab.com/v2/models/0e12af8c2073407cbd75fa510b8f85e2 http://www.leadwerks.com/werkspace/page/viewitem?fileid=734666279 1 Quote Let's build cool stuff and have fun.
Josh Posted August 2, 2016 Author Posted August 2, 2016 I'm having trouble with this. Anyone see what I am doing wrong? /* Load Sketchfab JSON info */ $jsonurl = 'https://api.sketchfab.com/v2/models/'.$fileinfo->publishedfiledetails->message[0]->previews->message[$i]->external_reference; $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $jsonurl ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); $data = curl_exec( $ch ); $output = json_decode($data); $thumbnailurl = $output->response->thumbnails->images[0]->url; Returned data: {"uid":"0e12af8c2073407cbd75fa510b8f85e2","publishedAt":"2016-07-30T23:38:59.690142","likeCount":0,"commentCount":0,"isDownloadAllowed":true,"isDownloadable":false,"processingStatus":2,"staffpickedAt":null,"isPrivate":false,"embedUrl":"https:\/\/sketchfab.com\/models\/0e12af8c2073407cbd75fa510b8f85e2\/embed","description":"","tags":[],"viewerUrl":"https:\/\/sketchfab.com\/models\/0e12af8c2073407cbd75fa510b8f85e2","isProtected":false,"vertexCount":1834,"user":{"username":"78alexandr1993","account":"free","displayName":"Nenerog","uid":"1b373f45bdf2458cb0b950e22b35665b","avatars":{"images":[{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/avatars\/78fa317e46024a5283765aa34df5e508\/02162695bdc840faa3bcb2d418309c5e.jpeg","width":90,"height":90,"size":5653},{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/avatars\/78fa317e46024a5283765aa34df5e508\/17fa177ffaa344a2b2fc8e78efd40fbb.jpeg","width":48,"height":48,"size":2518},{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/avatars\/78fa317e46024a5283765aa34df5e508\/aec92fe9a74e499c98d759362cd7f02f.jpeg","width":100,"height":100,"size":6421},{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/avatars\/78fa317e46024a5283765aa34df5e508\/6fde876cbded4cd48d36a76029e3aa02.jpeg","width":32,"height":32,"size":1350}],"uid":"78fa317e46024a5283765aa34df5e508"},"profileUrl":"https:\/\/sketchfab.com\/78alexandr1993"},"date":"2016-07-30T23:38:13.427562","urlid":"0e12af8c2073407cbd75fa510b8f85e2","categories":[],"thumbnails":{"images":[{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/urls\/0e12af8c2073407cbd75fa510b8f85e2\/dist\/thumbnails\/d828e5bbff0c42ad99e2e732c56c80bf\/50x50.jpeg","width":50,"size":1020,"uid":"7749d644b8b7494aa60eece424cb8c79","height":50},{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/urls\/0e12af8c2073407cbd75fa510b8f85e2\/dist\/thumbnails\/d828e5bbff0c42ad99e2e732c56c80bf\/100x100.jpeg","width":100,"size":2053,"uid":"3e727800424a48318addbfe053a7ccdd","height":100},{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/urls\/0e12af8c2073407cbd75fa510b8f85e2\/dist\/thumbnails\/d828e5bbff0c42ad99e2e732c56c80bf\/200x200.jpeg","width":200,"size":4706,"uid":"0e1bff8ae4744a5ebcfd87c4960bbae2","height":200},{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/urls\/0e12af8c2073407cbd75fa510b8f85e2\/dist\/thumbnails\/d828e5bbff0c42ad99e2e732c56c80bf\/448x252.jpeg","width":448,"size":8303,"uid":"80c4a5ebe1ab470bb35df705c078c23d","height":252},{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/urls\/0e12af8c2073407cbd75fa510b8f85e2\/dist\/thumbnails\/d828e5bbff0c42ad99e2e732c56c80bf\/640x360.jpeg","width":640,"size":13619,"uid":"e5f2869d1157453880a5d943950456cd","height":360},{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/urls\/0e12af8c2073407cbd75fa510b8f85e2\/dist\/thumbnails\/d828e5bbff0c42ad99e2e732c56c80bf\/864x486.jpeg","width":864,"size":20855,"uid":"dc7dafca893c44aab0e660ec421690cd","height":486},{"url":"https:\/\/d35krx4ujqgbcr.cloudfront.net\/urls\/0e12af8c2073407cbd75fa510b8f85e2\/dist\/thumbnails\/d828e5bbff0c42ad99e2e732c56c80bf\/1024x576.jpeg","width":1024,"size":26502,"uid":"70b51a95579c4f6198f0c1d552069dcc","height":576}],"uid":"d828e5bbff0c42ad99e2e732c56c80bf"},"viewCount":110,"name":"Hydrant Prop","license":null,"editorUrl":"https:\/\/sketchfab.com\/models\/0e12af8c2073407cbd75fa510b8f85e2\/edit","faceCount":2045,"downloadCount":0} Quote Let's build cool stuff and have fun.
Josh Posted August 2, 2016 Author Posted August 2, 2016 Got it. More proof that "rubber ducking" works. (The "response" parameter wasn't needed.) Quote Let's build cool stuff and have fun.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.