Jump to content

Recommended Posts

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!

 

Link to comment
https://forums.phpfreaks.com/topic/280602-explode-not-working-need-url-path/
Share on other sites

Unfortunately, not working :confused:

 

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 by Johnny_NW
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.