Responsive Lightbox & Gallery allows users to create galleries and view larger versions of images, galleries and videos in a lightbox (overlay) effect optimized for mobile devices.
For more information, check out plugin page at dFactory or see the Live demo on our site.
The WordPress Video Lightbox plugin allows you to embed videos on a page using lightbox overlay display.
This plugin can be used to display images, flash, YouTube, Vimeo, iFrame etc in a lightbox overlay. The embedded videos can be viewed on iPhone and iPad too.
EMBEDDING VIMEO VIDEO You can embed a vimeo video using the following shortcode in a WordPress post or page:
[video_lightbox_vimeo5 video_id="13562192" width="640" height="480" anchor="click here to open vimeo video"]
[video_lightbox_vimeo5 video_id="13562192" width="640" height="480" anchor="http://www.example.com/images/vimeo-thumb.jpg"]
You need to replace the value of “video_id” with your actual vimeo video ID. When a user clicks on the anchor text/image your vimeo video will pop up in lightbox.
EMBEDDING YOUTUBE VIDEO You can embed a YouTube video using the following shortcode in a WordPress post or page:
[video_lightbox_youtube video_id="G7z74BvLWUg" width="640" height="480" anchor="click here to open YouTube video"]
[video_lightbox_youtube video_id="G7z74BvLWUg" width="640" height="480" anchor="http://www.example.com/images/youtube-thumb.jpg"]
You need to replace the value of “video_id” with your actual YouTube video ID. You can also control the size of the lightbox window by customizing the width and height parameters.
OPTIMIZING THE SEO OF YOUR THUMBNAIL IMAGE When you are using a thumbnail image as the anchor, you can describe it using the “alt” parameter in the shortcode. It helps Search Engines understand what this image is about.
[video_lightbox_youtube video_id="G7z74BvLWUg" width="640" height="480" anchor="http://www.example.com/images/youtube-thumb.jpg" alt="text that describes this image"]
You need to replace the value of “alt” with your own description of the image.
FEATURES/SETTINGS CONFIGURATION
Once you have installed the plugin you can configure some options to customize the popup. The settings menu can be accessed from “Settings->Video Lightbox->prettyPhoto”.
Enable prettyPhoto: Check this option if you want to use the prettyPhoto library
Animation speed: fast / slow / normal [default: fast]
Autoplay slideshow: true / false [default: false]
Opacity: Value between 0 and 1 [default: 0.8]
Show title: true / false [default: true]
Allow resize: Resize the photos bigger than viewport. true / false [default: true]
Allow expand: Allow the user to expand a resized image. true / false [default: true]
Default width: default width of the lightbox window [default: 640, you can override it using the width parameter in the shortcode]
Default height: default height of the lightbox window [default: 480, you can override it using the height parameter in the shortcode]
Counter separator label: The separator for the gallery counter in lightbox [default: /]
Theme: theme for the lightbox window – Default, Light Rounded, Dark
Rounded, Light Square, Dark Square, Facebook
Horizontal padding: The padding on each side of the lightbox window [default: 20]
Hide Flash: Hides all the flash objects on a page, set to true if flash appears over prettyPhoto [default: false] wmode: the flash wmode attribute [default: opaque]
class Video {
const _youtube_regex = '/(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/';
const _youtubeshort_regex = '/(\/\/.*?youtu\.be)\/([^\?]+)(.*)/i';
const _vimeo_regex = '/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/';
/**
* Given filetype column from DB's article_medias table will return true if the media is video
* @param string $source source from article_medias.filetype column
* @return bool True if video
*/
public static function is_video( $source ) {
if ($source == 'youtube' || $source == 'youtu.be' || $source == 'vimeo') {
return true;
} else {
return false;
}
}
/**
* Given a url param to a youtube or vimeo video, will return the related format
* @param string $url Url to the video
* @return bool|string
*/
public static function get_source( $url ) {
if (preg_match(self::_youtube_regex, $url)) {
$format = 'youtube';
} else if (preg_match(self::_youtubeshort_regex, $url)) {
$format = 'youtu.be';
} else if (preg_match(self::_vimeo_regex, $url)) {
$format = 'vimeo';
} else {
return false;
}
return $format;
}
/**
* Given a video url to either a youtube or vimeo video, will return the specific video id
* @param string $url Video url
* @return bool|string
*/
public static function get_source_ID( $url ) {
$format = self::get_source($url);
switch ($format) {
case 'vimeo':
$vid_id = preg_replace(self::_vimeo_regex, '$2', $url);
if (substr($vid_id, 0, 5) == "http:") { $vid_id = substr($vid_id, 5); }
if (substr($vid_id, 0, 6) == "https:") { $vid_id = substr($vid_id, 6); }
break;
case 'youtube':
$vid_id = rtrim(preg_replace(self::_youtube_regex, '$2', $url), '?');
if (substr($vid_id, 0, 5) == "http:") { $vid_id = substr($vid_id, 5); }
if (substr($vid_id, 0, 6) == "https:") { $vid_id = substr($vid_id, 6); }
break;
case 'youtu.be':
$vid_id = rtrim(preg_replace(self::_youtubeshort_regex, '$2', $url), '?');
if (substr($vid_id, 0, 5) == "http:") { $vid_id = substr($vid_id, 5); }
if (substr($vid_id, 0, 6) == "https:") { $vid_id = substr($vid_id, 6); }
break;
default:
return false;
}
return $vid_id;
}
/**
* Gets the html url for the video
* @param string $id Video id
* @param string $format Video format/source
* @return bool|string returns url for embedding the video
*/
public static function get_embed_URL($url) {
$format = self::get_source($url);
$id = self::get_source_ID($url);
switch ($format) {
case 'vimeo':
$link = 'https://player.vimeo.com/video/'.$id;
break;
case 'youtube':
$link = 'https://www.youtube.com/embed/'.$id;
break;
case 'youtu.be':
$link = 'https://www.youtube.com/embed/'.$id;
break;
default:
return false;
}
return $link;
}
}