get_render_attribute_string( 'item_wrapper' ); ?> >
gallery_sizer_controller();
}
foreach( $items as $key=>$item ) {
$this->add_render_attribute( $key, 'class', 'htmega-flex-column htmega-video-gallery-filter-item' );
if ( $settings['filter_enable'] == 'yes' ) {
$this->add_render_attribute( $key, 'class', htmega_slugify( $item['filter_label'], true) );
}
//thumbnial generate
if ( $item['video_type'] == 'selfhosted' ) {
if ( !empty( $item['video_thumbnail']['url'] ) ) {
$thumbnailUrl = esc_url( $item['video_thumbnail']['url'] );
} else {
$thumbnailUrl = HTMEGA_ADDONS_PL_URL.'assets/images/image-placeholder.png';
}
} else {
$video_id = htmega_extract_video_id( $item['video_url']['url'] ); // get the video id from the link
if ( $item['video_type'] == 'vimeo' ) {
if ( !empty( $item['video_thumbnail']['url'] ) ) {
$thumbnailUrl = $item['video_thumbnail']['url'];
} else {
$vimeoVideoUrl = esc_url( $item['video_url']['url'] );
$encodedUrl = urlencode($vimeoVideoUrl);
$oembedApiUrl = "https://vimeo.com/api/oembed.json?url={$encodedUrl}";
$response = htmega_get_remote_file_data($oembedApiUrl);
if ( $response !== false ) {
$data = json_decode($response, true);
if ( isset($data['thumbnail_url']) ) {
$thumbnailUrl = $data['thumbnail_url'];
}
$newWidth = 1280;
$newHeight = 720;
$thumbnailUrl = preg_replace('/(\d+)x(\d+)/', "{$newWidth}x{$newHeight}", $thumbnailUrl);
}
}
} elseif ( $item['video_type'] == 'youtube' ) {
if ( !empty( $item['video_thumbnail']['url'] ) ) {
$thumbnailUrl = esc_url( $item['video_thumbnail']['url'] );
} else {
$thumbnailUrl ="https://img.youtube.com/vi/" . $video_id . "/maxresdefault.jpg";
}
}
}
?>
get_render_attribute_string( $key ); ?> >
' . esc_html( $item['video_title'] ) . '';
}
if ( $settings['show_video_description'] == 'yes' && !empty( $item['video_des'] ) ) {
echo '
' . esc_html( $item['video_des'] ) . '
';
}
?>