• islandcastaway

    (@islandcastaway)


    I would love to see a hook to be able to grab out thumbnails from Wordtube.

    cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sutherland Boswell

    (@sutherlandboswell)

    Hmmm… looking at the surface of wordTube I don’t immediately know how to add support for it. At the moment my plugin uses methods provided by the video services to retrieve the thumbnail. I’ll look into it some more and see if I figure something out.

    Thread Starter islandcastaway

    (@islandcastaway)

    I came up with some code to get the image from wordtube:

    <?php //wordtube
        $content  = $post->post_content;
        $wordtubeshortcode = stripos($content, "[media");
        if($wordtubeshortcode !== false){
        $matches = array();
        $html = $post->post_content;
        $pattern = "/\[media id=(\d+)\]/";
        preg_match( $pattern, $html, $matches );
        $wordtubeId = $matches['1'];
        $wordtubeimage = $wpdb->get_var($wpdb->prepare("SELECT image FROM $wpdb->wordtube WHERE vid = $wordtubeId;"));
        echo '<img src="'.$wordtubeimage.'">';
            }?>

    It does not work with the legacy [media=#] or [media id=# width=# height=#]

    to use width and height use:

    $pattern = "/\[media id=(\d+)(?: width=)?(\d+)?(?: height=)?(\d+)?\]/";

    Hopefully someone can improve on this.

    Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Video Thumbnails] Wordtube thumbnails’ is closed to new replies.