ryan Posted May 17, 2013 Author Share Posted May 17, 2013 If phpmotion.com supports oembed, then it is feasible for TextformatterVideoEmbed to support it in the same way as YouTube/Vimeo. Link to comment Share on other sites More sharing options...
vxda Posted September 12, 2013 Share Posted September 12, 2013 Hi, Is there a way to get a thumb img of a video ? Link to comment Share on other sites More sharing options...
adrian Posted September 12, 2013 Share Posted September 12, 2013 Hi vxda, Assume you are using youtube: http://stackoverflow.com/questions/2068344/how-to-get-thumbnail-of-youtube-video-link-using-youtube-api And here is some code for both youtube and vimeo: http://darcyclarke.me/development/get-image-for-youtube-or-vimeo-videos-from-url/ 1 Link to comment Share on other sites More sharing options...
vxda Posted September 12, 2013 Share Posted September 12, 2013 hi Adrian.cool i got the img Thank you. Now is there a way in module to get this youtube video id ? or do i have to do it with js ? thanks Link to comment Share on other sites More sharing options...
adrian Posted September 12, 2013 Share Posted September 12, 2013 It depends on what you want to do exactly. Because the module converts a Youtube link that is in an RTE texatarea field, you already know the id of the video because it is in the link. You could easily insert the image link using the url schema from that first link I posted. Maybe if you can explain your usage scenario we can help more. Where you do want to display the image? How is it connected to the embedded link. It is easy to grab the id of the video from the link in either PHP or JS using a regex, but the video module also stores the id in the PW database (in the textformatter_video_embed table), so this might also be an option depending on your needs. EDIT: Here is the function in the module that parses the video url: https://github.com/ryancramerdesign/TextformatterVideoEmbed/blob/master/TextformatterVideoEmbed.module#L127 Or you can use: $url = "http://www.youtube.com/watch?v=C4kxS1ksqtw&feature=relate"; parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars ); echo $my_array_of_vars['v']; // Output: C4kxS1ksqtw 1 Link to comment Share on other sites More sharing options...
vxda Posted September 12, 2013 Share Posted September 12, 2013 Wow Ty Adrian. Im just trying to open embeded video in the fancybox popup window after clicking on thumb. Again thanks alot Link to comment Share on other sites More sharing options...
adrian Posted September 12, 2013 Share Posted September 12, 2013 Ok, so it sounds like you are manually adding the thumbnail image to an RTE? Maybe you don't really need the video embed module, because you don't actually want the video to play inside the RTE field? There are lots of ways to go about this. You could use a regex in your template. You could make your own module. You could maybe use the Hanna Code module (http://modules.processwire.com/modules/process-hanna-code/) and just enter the video ID and use that to output the thumbnail and link to open in fancybox. You could even use JS to modify the link. An example of your exact usage would really help to narrow down the best approach. Link to comment Share on other sites More sharing options...
vxda Posted September 12, 2013 Share Posted September 12, 2013 i just did what u said, i dropped the module, now from admin panel i just enter the url for youtube movie and then i do this : <?php $videoFolder = $pages->find('parent=1051, limit=3'); $out =""; foreach($videoFolder as $videoItem){ $vidUrl = $videoItem->video; parse_str( parse_url( $vidUrl, PHP_URL_QUERY ), $my_array_of_vars ); $imgUrl = $my_array_of_vars['v']; $search = '/youtube\.com\/watch\?v=([a-zA-Z0-9]+)/smi'; $replace = "youtube.com/embed/$1?autoplay=1"; $vidUrl = preg_replace($search,$replace,$vidUrl); $out .= "<div>"; $out .= "<a class='fancybox' data-fancybox-type='iframe' href='{$vidUrl}'><img src='http://img.youtube.com/vi/{$imgUrl}/0.jpg' alt='{$videoItem->title}' /></a>"; $out .= "<div class='name'><a href='{$vidUrl}'>{$fotoItem->title}</a></div>"; $out .= "</div> "; } echo $out; ?> And thats it i got my video working Ty alot Adrian u ware most helpful 2 Link to comment Share on other sites More sharing options...
adrian Posted September 12, 2013 Share Posted September 12, 2013 Glad you got it working. The $videoItem->video makes me think you are storing the URL for the video in a dedicated field? If that's the case, you shouldn't need to do that preg_replace. You already have the id from $my_array_of_vars['v'] so you should be able to just build the embed version directly from that. 1 Link to comment Share on other sites More sharing options...
vxda Posted September 12, 2013 Share Posted September 12, 2013 Glad you got it working. The $videoItem->video makes me think you are storing the URL for the video in a dedicated field? If that's the case, you shouldn't need to do that preg_replace. You already have the id from $my_array_of_vars['v'] so you should be able to just build the embed version directly from that. HA! ... true <?php $videoFolder = $pages->find('parent=1051, limit=3'); $out =""; foreach($videoFolder as $videoItem){ $vidUrl = $videoItem->video; parse_str( parse_url( $vidUrl, PHP_URL_QUERY ), $my_array_of_vars ); $vidID = $my_array_of_vars['v']; $out .= "<div>"; $out .= "<a class='fancybox' data-fancybox-type='iframe' href='http://www.youtube.com/embed/{$vidID}?autoplay=1'><img src='http://img.youtube.com/vi/{$vidID}/0.jpg' alt='{$videoItem->title}' /></a>"; $out .= "<div class='name'><a href='http://www.youtube.com/embed/{$vidID}?autoplay=1'>{$videoItem->title}</a></div>"; $out .= "</div> "; } echo $out; ?> Ty alot Link to comment Share on other sites More sharing options...
apeisa Posted November 11, 2013 Share Posted November 11, 2013 Just noticed that if you copypaste youtube url from Chrome (Win7) addressbar into CKeditor, it will be transformed into <a> tag and therefor embedding doesn't work. I don't know how CKeditor does that, since if you copypaste it from another source (like text editor), it will not be transformed into a link. Possible solution could be allowing links also transformed into a embed. What do you think? 1 Link to comment Share on other sites More sharing options...
ryan Posted November 14, 2013 Author Share Posted November 14, 2013 It might just be a matter of the forum using an older version of CKEditor (3 vs 4). Does it work if you do an unformatted paste? i.e. shift+ctrl+v ? Though I'd have no problem making it support the videos as links, but it seems like that then creates a problem where you actually want to link to a video (as opposed to embedding it). If someone puts the link in it's own paragraph, maybe it's safe to assume they are trying to embed though. Especially if the anchor text matches the src attribute. Link to comment Share on other sites More sharing options...
boris Posted January 6, 2014 Share Posted January 6, 2014 Hi all, I have an issue with the module. It works fine for me under all browsers apart from Firefox(Win 7) - I've updated to version 26.0, from 24.*; However I still get only a black box. I can see the code, exactly the same as under Chrome/Safari/Opera, but it doesn't work. Any ideas what could be causing the problem ? p.s. I get no errors with Firebug. Link to comment Share on other sites More sharing options...
ryan Posted January 11, 2014 Author Share Posted January 11, 2014 Is it possible your browser doesn't have the necessary plugins to display videos (Flash, etc.) or has some kind of blocker installed? I know with my copy of Firefox, both are the case (no flash, and everything external blocked... but it was intentionally configured that way). Link to comment Share on other sites More sharing options...
encho Posted January 27, 2014 Share Posted January 27, 2014 Is there any way I can call that youtube ID part from template using this module? Youtube uses these urls: http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpghttp://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpghttp://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpghttp://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg to give us pre-generated thumbnails, so it would be great if I could use thumbnails on my front page as a preview, which leads to full page with properly embeded video. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted January 27, 2014 Share Posted January 27, 2014 Adrian wrote a wonderfull module for that http://modules.processwire.com/modules/process-get-video-thumbs/ Side benefit: you can search pages with video's 3 Link to comment Share on other sites More sharing options...
encho Posted January 27, 2014 Share Posted January 27, 2014 Adrian wrote a wonderfull module for that http://modules.processwire.com/modules/process-get-video-thumbs/ Side benefit: you can search pages with video's Thanks! Fantastic job Adrian! And thanks to Ryan for making this possible. Is there anything PW can't do? Link to comment Share on other sites More sharing options...
horst Posted February 5, 2014 Share Posted February 5, 2014 @Ryan: fantastic Module. I have used it the first time now on a site for a colleague. There is one thing I want to ask if it could be possible: With the param rel=0 added to the $embedCode $queryString (e.g. ?feature=oembed&rel=0) the video gets reset to the first frame of it after playing, - instead of displaying a lot of thumbs to other videos. On some pages / sites it looks much better this way. Can this be added to the module? (maybe as option, or default?) Link to comment Share on other sites More sharing options...
ryan Posted February 7, 2014 Author Share Posted February 7, 2014 Horst, it should already support the rel=0 option for video embedding (at least it used to). Try adding it to the YouTube URL you are embedding. If it doesn't work, go to the module settings and clear the video cache and try again. Link to comment Share on other sites More sharing options...
horst Posted February 7, 2014 Share Posted February 7, 2014 Ryan, unfortunately it doesn't work. (have flushed the DB) My url is and the resulting code in DB is video_id = oUdcc7fYlp8?rel=0 embed_code = <iframe width="640" height="360" src="http://www.youtube.com/embed/oUdcc7fYlp8?feature=oembed" frameborder="0" allowfullscreen></iframe> The rel=0 doesn't make it into the embedded code. ?? Link to comment Share on other sites More sharing options...
Pierre-Luc Posted March 9, 2014 Share Posted March 9, 2014 Fixed an issue with embedding in secure pages. YouTube's oembed service doesn't return https urls, even if the feed url is https. Change line 86 to: $embedCode = str_replace('http','https',$data['html']); Link to comment Share on other sites More sharing options...
adrian Posted March 9, 2014 Share Posted March 9, 2014 Hey Pierre-Luc, There is actually a note about https on github: https://github.com/ryancramerdesign/TextformatterVideoEmbed/pull/3 Perhaps you should add to that issue, or start a new one. That will be the easiest way for Ryan to track the problem. 1 Link to comment Share on other sites More sharing options...
Pierre-Luc Posted March 9, 2014 Share Posted March 9, 2014 Thanks Adrian, I added a comment on the issue. Hey Pierre-Luc, There is actually a note about https on github: https://github.com/ryancramerdesign/TextformatterVideoEmbed/pull/3 Perhaps you should add to that issue, or start a new one. That will be the easiest way for Ryan to track the problem. Link to comment Share on other sites More sharing options...
Zahari M. Posted March 16, 2014 Share Posted March 16, 2014 Hi Guys! A question for you gents... Is it possible to modify the module such that it automatically adds &rel=0 to all our YouTube video urls that we enter? Been trying to plug it in into various parts of the module but I can't seem to get it to work. It would save having to type in $rel=0 every single time I add a video. Cheers guys! Link to comment Share on other sites More sharing options...
Martijn Geerts Posted March 16, 2014 Share Posted March 16, 2014 After you installed the Textformatter, go to /site/modules/TextformatterVideoEmbed.module add a line in the methode embedYoutube: // line number +/- 145 $queryString = isset($matches[3][$key]) ? $matches[3][$key] : ''; $queryString = $queryString . "&rel=0"; // this is the new line you should add --- If you make modifications to this module, it's better to rename the module and the file and install it again. This to insures updates won't delete your modifications Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now