유튜브 썸네일이 보이지 않네요...(data/file에 저장이 안됩니다) 도움좀 주세요... 채택완료
</p>
<p><?
$bo_gallery_cols = "2";
$td_width = (int)(100 /$bo_gallery_cols);</p>
<p>$thumb_width = $webzine_youtube_type_img_width ; //썸네일 가로길이
$thumb_height = $webzine_youtube_type_img_height; //썸네일 세로길이</p>
<p>// 썸네일 디렉토리
$thumb_path = G5_DATA_PATH.'/file/'.$bo_table;
$thumb_file_path = G5_DATA_URL.'/file/'.$bo_table;
?></p>
<p><table width="<?=$width?>" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td height="1" bgcolor="#CCCCCC"></td><tr>
</table></p>
<p><table width="<?=$width?>" border="0" cellspacing="0" cellpadding="0" align="center">
<tr></p>
<p><!-- 목록 --></p>
<p> <?php
for ($i=0; $i<count($list); $i++) {
$file = get_file($bo_table, $list[$i]['wr_id']); </p>
<p>
if($i>0 && ($i % $bo_gallery_cols == 0))
echo "</tr><tr>";</p>
<p> $bg = 'bg'.($i%2);
?></p>
<p> <?php if ($list[$i][wr_link1]) { //동영상 플레이어
// 실제 구동 동영상 = 링크가 있으면 먼저 출력함
if ($list[$i][wr_link1]) { $mov_play_file = "{$list[$i][wr_link1]}"; }
$img = "";
// 썸네일 생성
if ($list[$i][wr_link1]) {
$youtube = str_replace("<a href="<a href="https://youtu.be/" target="_blank" rel="noopener noreferrer">https://youtu.be/</a>" target="_blank"><a href="https://youtu.be/" target="_blank" rel="noopener noreferrer">https://youtu.be/</a></a>","","{$list[$i][wr_link1]}");
$youtueb_img = "<a href="<a href="http://img.youtube.com/vi/" target="_blank" rel="noopener noreferrer">http://img.youtube.com/vi/</a>" target="_blank"><a href="http://img.youtube.com/vi/" target="_blank" rel="noopener noreferrer">http://img.youtube.com/vi/</a></a>{$youtube}/0.jpg";
if ($youtueb_img) {
// 유튜브 이미지 파일에서 썸네일 추출
$mov_file_path = "{$youtueb_img}";
$mov_file_thumb = "{$youtueb_img}";
$thumb = "{$thumb_path}/thumb-youtube_{$list[$i][wr_id]}_{$thumb_width}.jpg";
$img = "{$thumb_file_path}/thumb-youtube_{$list[$i][wr_id]}_{$thumb_width}.jpg";
$thumb_file = $mov_file_thumb;
} </p>
<p> // 썸네일이 없다면
if (!file_exists($thumb)) {
createThumb_webzine($thumb_width, $thumb_height, $thumb_file, $thumb, true); //상단을 20px 잘라고 출력함
}
} </p>
<p> if ($img) {
$img_content = '<img src="'.$img.'" width="'.$thumb_width.'" height="'.$thumb_height.'">';
} else {
$img_content = '<span style="display:inline-block; text-align: center; background-color: #EDEDED; line-height:'.$thumb_height.'px; width:'.$thumb_width.'px;height:'.$thumb_height.'px;">
<div style="height:10px;"></div><div class="fa fa-image fa-3x" style="color:#AAAAAA;"></div></span>';
}
}
?></p>
<p>
답변 2개
</p>
<p>if ($list[$i][wr_link1]) { </p>
<p> $youtube = str_replace("<a href="<a href="https://youtu.be/" target="_blank" rel="noopener noreferrer">https://youtu.be/</a>" target="_blank"><a href="https://youtu.be/" target="_blank" rel="noopener noreferrer">https://youtu.be/</a></a>","","{$list[$i][wr_link1]}"); .</p>
<p> $youtueb_img = "<a href="<a href="http://img.youtube.com/vi/" target="_blank" rel="noopener noreferrer">http://img.youtube.com/vi/</a>" target="_blank"><a href="http://img.youtube.com/vi/" target="_blank" rel="noopener noreferrer">http://img.youtube.com/vi/</a></a>{$youtube}/0.jpg";</p>
<p>
* 다음줄에 $youtueb_img 를 출력하여 나오는 주소(http://img.youtube.com/vi/{$youtube}/0.jpg">http://img.youtube.com/vi/~/0.jpg ) 를
브라우저에 직접 입력해서, 이미지 확인이 되는지 살펴보셨으면 합니다.
* 지금의 코드는 유튜브 영상의 주소를 'https://youtu.be/~'">https://youtu.be/~' 로 입력하는 경우에만 문제가 없고,
다른 형태의 주소인 경우는( https://www.youtube.com/watch?v=JsoIT6TnSuI&t=43s">https://www.youtube.com/watch?v=~ 등) 썸네일 추출을 하지 못할 가능성이 있는 코드입니다.
이 부분들을 검토해 볼 수 있을 듯 합니다.
$youtueb_img 변수명에 오타가 있는 듯 한데.. $youtube_img 로 모두 고쳐주는 것도 좋을 것 같습니다.
댓글을 작성하려면 로그인이 필요합니다.
답변 감사합니다 현재 (http://img.youtube.com/vi/%7B$youtube%7D/0.jpg" rel="nofollow">http://img.youtube.com/vi/~/0.jpg) 을 브라우저에 입력했더니 이미지가 나오는 것은 확인하였습니다.
유튜브 동영상을 'https://youtu.be/~'" rel="nofollow">https://youtu.be/~' 업로드 해도 썸네일이 안나오고 ( https://www.youtube.com/watch?v=JsoIT6TnSuI&t=43s" rel="nofollow">https://www.youtube.com/watch?v=~ 등) 이런 방식으로 업로드해도 안나오네요....
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
$thumb_file, $img 를 echo 로 확인해보면서 문제를 살펴볼 수 있습니다.
자체 썸네일 만드는 부분의 오류 확인 및 해결이 어려운 경우에는,
유튜브 자체 썸네일 주소정보를 바로 <img> 태그로 넣어주는 방법을 검토해볼 수 있습니다.
<img src="http://img.youtube.com/vi/~/mqdefault.jpg">