If you use php on your site and share video from Youtube or vimeo, see how you can change their size easily, without changing every single post.

Let's say you have a post and it contains an embed code from Youtube. You will going to pass the post's content into a variable named $post.

Using the preg_replace function we'll change the size of the video.

This way will always keep the videos in one size, which is ideal if you have a lot of posts and you don't want to change them manually.

$post= preg_replace('/(width)=("[^"]")/i', 'width="600"', $post);
$post= preg_replace('/(height)=("[^"]
")/i', 'height="400"', $post);

284 Reads | Added:April 25, 2010

Leave a Reply

Your email address will not be published.