Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Video 无法加载图像。确保路径正确且图像存在_Video_Youtube_Xhtml 1.0 Strict_Prettyphoto - Fatal编程技术网

Video 无法加载图像。确保路径正确且图像存在

Video 无法加载图像。确保路径正确且图像存在,video,youtube,xhtml-1.0-strict,prettyphoto,Video,Youtube,Xhtml 1.0 Strict,Prettyphoto,在我的页面上,我有一个YouTube视频的缩略图作为图像,我想在用户单击图像后使用pretto播放视频。我怎样才能做到这一点 以下是我的图像代码: <div class="video" id="videoPlaceHolder" style="position:relative;"> <a rel="prettyPhotos" href="https://www.youtube.com/embed/<?php getFirstFeatureVideoURL(); ?&

在我的页面上,我有一个YouTube视频的缩略图作为图像,我想在用户单击图像后使用pretto播放视频。我怎样才能做到这一点

以下是我的图像代码:

<div class="video" id="videoPlaceHolder" style="position:relative;">
  <a rel="prettyPhotos" href="https://www.youtube.com/embed/<?php getFirstFeatureVideoURL(); ?>">
    <img style="background:url(<?php getFirstFeatureVideoThumbnail() ?>); background-repeat:no-repeat; background-size:cover;  -moz-background-size: cover;" src="/images/ytIndex_overlay.png" onClick="addPlayer();" />
  </a>
</div>

php函数
getFirstFeatureVideoURL
获取并返回第一个视频的“正确”URL(我已经单独检查过,视频播放时没有任何问题)。另一个名为
getFirstFeatureVideoThumbnail
的函数返回视频的缩略图。我已经为
to
准备好了所有的插件,到目前为止,它对所有图像都非常有效。但是,当我试图通过单击图像来播放此视频时,会出现以下错误:

无法加载图像。确保路径正确且图像存在


为什么会出现此错误?

它希望
href
是一个URL。你不能在这样的URL中嵌入PHP代码。

好的,所以我在PHP函数中生成了标记,如下所示,解决了我的问题

function getFeatureVideo()
{
$xml = simplexml_load_file('https://gdata.youtube.com/feeds/api/playlists/A4F160EDF82713A2?v=2');
.
.
.
.
$media = $entry->children('http://search.yahoo.com/mrss/');

  $attrs = $media->group->player->attributes();
  $watch = $attrs['url'];

  $attrs = $media->group->thumbnail[1]->attributes();
  $thumbnail = $attrs['url'];

  $result .='<a rel="prettyVideos"  href="'.$watch.'">
                <img style="background:url('.$thumbnail.'); background-repeat:no-repeat; background-size:cover;  -moz-background-size: cover;" src="/images/ytIndex_overlay.png" onClick="addPlayer();" />
       </a> ';      

echo $result;                    
}
函数getFeatureVideo() { $xml=simplexml\u加载\u文件('https://gdata.youtube.com/feeds/api/playlists/A4F160EDF82713A2?v=2'); . . . . $media=$entry->children('http://search.yahoo.com/mrss/'); $attrs=$media->group->player->attributes(); $watch=$attrs['url']; $attrs=$media->group->缩略图[1]->属性(); $thumbnail=$attrs['url']; $result.=''; 回声$结果; }
您试图获取的缩略图版本是什么。我猜您尝试检索标准定义缩略图或最大分辨率缩略图。对于此视频id:id_kGL3M5Cg,它们都不存在

使用此工具检查其是否存在:

我得到了结果, 标准清晰度缩略图不适用于此视频。 最大分辨率缩略图不适用于此视频

您可以使用
get\u headers
检查图像是否存在。检查本教程中代码的缩略图部分:

但href=“”