팁과노하우

2024.06.19 17:36

글 또는 코멘트의 유튜브 URL 뒤에 영상 불러오기 (반응형)

https://sir.kr/g5_plugin/7537

thisgun님의 플러그인을 반응형으로 수정한 겁니다. 

글이나 코멘트에 유튜브 주소가 있으면 아래에 영상이 나옵니다. 




1e04c033407ad9cf9df7c6fed05fb7b7_1718786168_2024.png 


1e04c033407ad9cf9df7c6fed05fb7b7_1718786168_1348.png 



1. youtube_embed.extend.php 파일은 extend 폴더에 넣어 주세요.


2. 관리자 -> 환경설정 -> 기본환경설정 -> 레이아웃 추가설정 -> 추가 script, css



<style>
.Video_Container {
  position:relative;
  height:0;
  padding-bottom:56.25%;
  overflow:hidden}
  
 .Video_Container iframe {
   position:absolute;
   width:100%;
   height:100%;
   top:0%;
   left:0%;
  }
</style>


추가해 주시면 주시면 됩니다.




(추가) 모바일에서만 보이고 싶으면 youtube_embed.extend.php 파일 내용을 수정하시면 됩니다.



 

  • 공유링크 복사
    미니홈 쪽지 구독하기
    구독하고 알림받기

    댓글목록

    profile_image
    no_profile 다음어디미니홈 1:1 대화하기  오래 전

    감사합니다. 필요한 기능이었어요

    2024-06-19 23:33

    profile_image
    no_profile 다음어디미니홈 1:1 대화하기  오래 전

    적용이 잘 되서 정말 편합니다. 다만 크기가 100%라 pc에서 보기에는 약간 부담스러운 감이 있어 pc에서만 크기를 줄이고 싶은데 어떻게 해야할지 조언을 얻을수 있을까요?
    하단 크기를 변경했더니 모바일과 같이 줄어들어서 pc만 줄이는 방법이 있는지 궁금합니다.

    2024-06-20 00:22

    profile_image
    Leegun미니홈 1:1 대화하기  오래 전

    <?php if(is_mobile()) { ?>
                return str+'<div class="Video_Container"><iframe src="https://www.youtube.com/embed/' + key + '" frameborder="0" allowfullscreen></iframe></div>';
                <?php } else { ?>
                return str+'<div><iframe width="320" height="240" src="https://www.youtube.com/embed/' + key + '" frameborder="0" allowfullscreen></iframe></div>';
                <?php } ?>

    로 바꾸시면 됩니다.

    2024-06-20 05:20

    profile_image
    April미니홈 1:1 대화하기  오래 전

    감사합니다
    PC 가변형이 있었으면 좋겠네요

    2024-06-20 00:44

    profile_image
    Leegun미니홈 1:1 대화하기  오래 전

    <div class="Video_Container"><iframe src="https://www.youtube.com/embed/' + key + '" frameborder="0" allowfullscreen></iframe></div>';

    이게 제가 반응형으로 바꾼거고

    <div><iframe width="320" height="240" src="https://www.youtube.com/embed/' + key + '" frameborder="0" allowfullscreen></iframe></div>';

    이게 원본 입니다.

    2024-06-20 05:21

    profile_image
    관리자미니홈 1:1 대화하기  오래 전

    게시판 활성에 힘써주셔서 고맙습니다~
    500포인트 보내드립니다 ^^

    2024-06-20 12:46

    profile_image
    no_profile 팡야미니홈 1:1 대화하기  오래 전

    고맙습니다

    2024-06-24 12:33