Johnny_NW Posted July 28, 2013 Share Posted July 28, 2013 I am really confused here.... I'll insert URL for an embeded video, and it does embed the video onto the website. And it also grabs the associated video thumbnail for that video from hosting server, IF and ONLY IF I put an absolute URL for the video thumbnail. This isn't cool, because I don't want all my embed videos to have the same video thumbnail. So the code works like this, but this gives the same video thumbnail for all videos: $thumbnail = "http://cdn1.image.website.webcdn.com/201111/09/664006/original/8.jpg"; What I am tryign to do is get to /664006/ and insert my variable $url_id, which this works too, BUT still only the same video thumbnail /201111/09 : $thumbnail = 'http://cdn1.image.website.webcdn.com/201111/09/' . $url_id . '/original/8.jpg'; So I know I need to get through /201111/09 to get to $url_id BUT THIS IS NOT WORKING WHY is this not working? PLEASE any help would be sincerely appreciated: $thumbnail = 'cdn1.image.website.webcdn.com/201111/09/664006/original/8.jpg'; $arr = explode('/', $thumbnail); $url_id = $arr[3]; $thumbnail = 'cdn1.image.website.webcdn.com/'. $arr[1] . '/' . $arr[2] . '/' . $url_id . '/original/8.jpg'; Thanks for your help, in advance! Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 28, 2013 Share Posted July 28, 2013 The "cdn1.image.website.webcdn.com" is NOT a web root directory, it's a domain name of the web server. Try, $thumbnail = $_SERVER['DOCUMENT_ROOT'].$arr[1] . '/' . $arr[2] . '/' . $url_id . '/original/8.jpg'; Quote Link to comment Share on other sites More sharing options...
Johnny_NW Posted July 28, 2013 Author Share Posted July 28, 2013 (edited) Unfortunately, not working I tried all of these: $thumbnail = $_SERVER['DOCUMENT_ROOT'] . $arr[1] . '/' . $arr[2] . '/' . $url_id. '/original/8.jpg'; $thumbnail = $_SERVER['SERVER_NAME'] . $arr[1] . '/' . $arr[2] . '/' . $url_id. '/original/8.jpg'; $thumbnail = $_SERVER['HTTP_HOST'] . $arr[1] . '/' . $arr[2] . '/' . $url_id. '/original/8.jpg'; And I even tried: $thumbnail = $_SERVER['DOCUMENT_ROOT'] . '/'. $arr[1] . '/' . $arr[2] . '/' . $url_id. '/original/8.jpg'; Any other suggestions? I am totally desperate for an answer, to be honest Edited July 28, 2013 by Johnny_NW Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted July 28, 2013 Share Posted July 28, 2013 What result you get if you try to echo the $thumbnail variable. $thumbnail = $_SERVER['DOCUMENT_ROOT'] . '/'. $arr[1] . '/' . $arr[2] . '/' . $url_id. '/original/8.jpg'; echo $thumbnail; Quote Link to comment Share on other sites More sharing options...
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.