Integrer video youtube via url

asus02 Messages postés 197 Date d'inscription   Statut Membre Dernière intervention   -  
asus02 Messages postés 197 Date d'inscription   Statut Membre Dernière intervention   -
bonjour, je tatonne mais voila en gros ce que je voudrais, recuperer une url youtube posté sur mon site pour qu'elle puisse etre visualise ...

j'ai testé ce code mais ca ne fonctionne pas, je ne comprend pas trop les regex alors merci d'etre indulgents ...

$statut_resize = preg_replace('#^http://(?:www\.)?youtube\.com/watch\?(?:[^=]+=[^&]+&)*v=([^&]+)#i', 'http://www.youtube.com/v/$2'
<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$2"><param name="movie" value="http://www.youtube.com/v/$2"></param></object>,   $statut_resize);


et ca

$statut_resize = preg_replace('#^http://(?:www\.)?youtube\.com/watch\?v=([^&]+)#i', 'http://www.youtube.com/v/$2');
$statut_resize = '<object width="125" height="100" type="application/x-shockwave-flash" data="'.$statut_resize.'"><param name="movie" value="'.$statut_resize.'"></param></object>';


mais pas de resultat positif ...
A voir également:

3 réponses

Marie25
 
Bonsoir,
Il est bien placé dans ton objet web ?
Quel est le code ? Copie / Colle on regardera.
A+
Marie
0
asus02 Messages postés 197 Date d'inscription   Statut Membre Dernière intervention   13
 
$html .= ' <img alt="photo_user" class="news_photo"
						src="'.$config['site_url'].'devoliarsed-img.php?img='.$owner->get_photo_profil()
								.'&width=60&height=60&mode=crop"/>';
					
					$html .= "<div class='piece_news'>";	
						$html .= "<strong><a  href=\"profil-".$owner->get_id().".html\">".$owner->get_firstname()." "
						.$owner->get_name()."</a></strong> : ";
						$statut_resize = $this->correct_news(utf8_encode(stripslashes($this->content)),65,$size_pseudo);
                        $statut_resize = preg_replace('#http://\S+?\.(?:jpg|png|gif)#i', '<br/><a href="$0" class="lienCommentaire" rel="lightbox" target="_blank"><img src="$0" width="130" height="90"/><br/>- Agrandir -<br/></a>', $statut_resize);					                     
						$statut_resize = preg_replace('#(?<!<a href="|<img src=")http://\S+#i', '<a href="$0" target="_blank">$0</a>', $statut_resize);
						$statut_resize = preg_replace('#^http://(?:www\.)?youtube\.com/watch\?v=([^&]+)#i', 'http://www.youtube.com/v/$2');
						$statut_resize = '<object width="125" height="100" type="application/x-shockwave-flash" data="'.$statut_resize.'"><param name="movie" value="'.$statut_resize.'"></param></object>';                      						
                        $html .= '<br/><br/><span class="piece_news_date">'.$this->get_delay($this->date).'</span>';
											
						$html .= ' . <a 
							onclick="if (document.getElementById(\'comForm_'.$this->get_id().'\').style
								.display == \'block\') {
							document.getElementById(\'comForm_'.$this->get_id().'\').style.display = \'none\'; }
							else {document.getElementById(\'comForm_'.$this->get_id().'\').style
								.display = \'block\';
								document.getElementById(\'idCom_'.$this->get_id().'\').focus()}">
							Comment</a><br/>';
0
asus02 Messages postés 197 Date d'inscription   Statut Membre Dernière intervention   13
 
j'ai testé cette regex mais pas de lecteur, j'ai uniquement le lien cliquable .

$statut_resize = preg_replace('#^(http://)?www\.youtube\.com/watch\?v=(\w+)(&.*)?$#i','<object width="150" height="155">
                                <param name="movie" value="http://www.youtube.com/v/$2?fs=1&amp;hl=fr_FR"></param>
                                <param name="allowFullScreen" value="true"></param>
                                <param name="allowscriptaccess" value="always"></param>
                                <embed src="http://www.youtube.com/v/$2?fs=1&amp;hl=fr_FR" type="application/x-shockwave-flash"               allowscriptaccess="always" allowfullscreen="true" width="150" height="155"></embed>
                        </object>',$statut_resize);
</code>
0