... when using HTML in your posts, make sure that the valid structure of the HTML document is respected. It is forbidden to use potentially dangerous objects, such as ActiveX, JavaScript, VBScript, Java applets, Frames and IFrames, connected from external CSS sites, Meta Refresh, etc. (the use of such elements may lead to blocking of your mailings);
/** * youtube play * * @param $youtube_id Id of youtube-video url, youtube, rutube vimeo * * @return * Url (480360px) selectel , - * OR FALSE if error */ function youtube_thumbnail_with_play($youtube_id,$url = '') { // youtube? if ($youtube_id === '0'){ if(stripos($url,'rutube.ru') !== FALSE){ preg_match("/http:\/\/rutube.ru\/video\/(\w+)\//",$url,$matches); $xml_info = simplexml_load_file("http://rutube.ru/cgi-bin/xmlapi.cgi?rt_mode=movie&rt_movie_id=".$matches[1]."&utf=1"); if ($xml_info) { $thumbnail_url = (string) $xml_info->thumbnail_url; } }elseif(stripos($url,'vimeo.com') !== FALSE){ if ((stripos($url,'https') !== FALSE)) {$vimeo_id = substr($url,18);} else {$vimeo_id = substr($url,17);} $xml_info = simplexml_load_file("http://vimeo.com/api/v2/video/$vimeo_id.xml"); if ($xml_info) { $thumbnail_url = (string) $xml_info->video->thumbnail_large; } }else{ return FALSE; } }else{ $thumbnail_url = 'http://img.youtube.com/vi/'.$youtube_id.'/hqdefault.jpg'; } // Make sure the imagecopymerge() function exists (in GD image library). if (!function_exists('imagecopymerge')) { return FALSE; } $image = imagecreatefromjpeg($thumbnail_url); if (!$image) {return FALSE;} $image_size = getimagesize($thumbnail_url); // Calculate the proper coordinates for placing the play button in the middle. $destination_x = ($image_size[0] / 2) - 35; $destination_y = ($image_size[1] / 2) - 35; // Load the play button image. $play_button_image = imagecreatefrompng($root.'/images/play_button.png'); imagealphablending($play_button_image, TRUE); // Preserve transparency. imagealphablending($image, TRUE); // Preserve transparency. // Use imagecopy() to place the play button over the image. imagecopy( $image, // Destination image. $play_button_image, // Source image. $destination_x, // Destination x coordinate. $destination_y, // Destination y coordinate. 0, // Source x coordinate. 0, // Source y coordinate. 70, // Source width. 70 // Source height. ); if (is_dir($root.'/html/other/')===false){ mkdir($root.'/html/other/'); } $rand_path = $root.'/html/other/'.md5(time().rand(0,100000)).'.png'; imagepng($image,$rand_path); $selectel_str = $wizard->cloud_upload($rand_path); // selectel if (strpos($selectel_str, 'http://static1.pechkin-mail.ru/') !== false) {unlink($rand_path);} imagedestroy($image); imagedestroy($play_button_image); return $selectel_str; }
Source: https://habr.com/ru/post/226157/
All Articles