574 posts Themes and Graphics
  • Has been part of the Envato Community for over 5 years
  • Has referred 50+ members
  • Has sold $250,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+9 more
Bebel says

Hi,

I am trying to get the embed function of wordpress to resize embedded flash images to a given height and(!) width. Right now, the method seems to resize videos only proportional, as they get the information via oEmbed. Is there any flag that I have overseen, or should I directly manipulate the output given by $foo->run_shortcode() with regex or whatsoever?

In short: I want a video to be rendered in a given box, lets say with a size of 200×120. The embed class only returns videos in the proportions they were recorded at. 16:9 or 4:3 or …

Any Ideas?

Cheers Bebel

16 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
ashgoodman says
Hi,

I am trying to get the embed function of wordpress to resize embedded flash images to a given height and(!) width. Right now, the method seems to resize videos only proportional, as they get the information via oEmbed. Is there any flag that I have overseen, or should I directly manipulate the output given by $foo->run_shortcode() with regex or whatsoever?

In short: I want a video to be rendered in a given box, lets say with a size of 200×120. The embed class only returns videos in the proportions they were recorded at. 16:9 or 4:3 or …

Any Ideas?

Cheers Bebel

Afraid not, its not wordpress thats the problem, its the oembed protocol. The source (for example youtube) must respect width, but they don’t have to respect height.

574 posts Themes and Graphics
  • Has been part of the Envato Community for over 5 years
  • Has referred 50+ members
  • Has sold $250,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+9 more
Bebel says

Thats what I thought. Thanks anyway. I now implemented it like this, if anybody runs in the same problem:

          $embed = new WP_Embed();
          $video = $embed->run_shortcode('[embed  height="200"]'.$your_video_url.'[/embed]');
          $video = preg_replace('/width=\"(\d)*\"/', 'width="344"', $video);

Its not a solution I am proud of, but it works and doesn’t destroy my styling anymore

2445 posts
  • Has referred 100+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
digitalimpact says

Thanks for posting the solution Bebel, bookmarked your hack :)

688 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
_rg_ says

Great i was looking for same thing! Thks

16 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
ashgoodman says
Thats what I thought. Thanks anyway. I now implemented it like this, if anybody runs in the same problem:
          $embed = new WP_Embed();
          $video = $embed->run_shortcode('[embed  height="200"]'.$your_video_url.'[/embed]');
          $video = preg_replace('/width=\"(\d)*\"/', 'width="344"', $video);
Its not a solution I am proud of, but it works and doesn’t destroy my styling anymore
Nice approach. Thanks!
688 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
_rg_ says

Well, playing with that code i discovered the best way to get any size video is this:


$wp_embed = new WP_Embed();
$post_embed = $wp_embed->run_shortcode('[embed]'.$post_custom_video.'[/embed]');
$post_embed = preg_replace('/width=\"(\d)*\"/', 'width="660"', $post_embed);
$post_embed = preg_replace('/height=\"(\d)*\"/', 'height="295"', $post_embed);
echo $post_embed;

Where $post_custom_video is, in this case, a custom meta field from post or page. The video url in other words.

As you can see there you can set up any w & h.

By the way, does anybody about this:

http://www.image-share.com/ijpg-388-170.html

Look at the title and “from” links… the color from the link is like a stripped background…. i don´t know why this happens. Could be the opacity animation using jquery for the slider? , but is strange.

688 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
_rg_ says

mmm, it´s very strange. Seems like you need to put a black bacground for videos from Vimeo. The stripped background on text links, was exactly the same stripped background i was using on the body!! ja, so, i change the video div to a black bacground and solved.

But guess what? The blue/orante for the default link/hover states on the video title and author, change depending on the background color for the div containing it.

Has no scence, but….

688 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
_rg_ says

well, yes, me again :)

You know, there´s a problem with the embed into a slider… as the embed uses an iframe, items on slider will not re-load when moving to next item.

With the normal embed, directly on the html using object or swfobject or both, this doesnt´happend, and each time you click on next item, the currently, if playing, stops.

Now i need to find a solution for that…. something with the iframe loading content or so…. :)

574 posts Themes and Graphics
  • Has been part of the Envato Community for over 5 years
  • Has referred 50+ members
  • Has sold $250,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+9 more
Bebel says
mmm, it´s very strange. Seems like you need to put a black bacground for videos from Vimeo. The stripped background on text links, was exactly the same stripped background i was using on the body!! ja, so, i change the video div to a black bacground and solved.

But guess what? The blue/orante for the default link/hover states on the video title and author, change depending on the background color for the div containing it.

Has no scence, but….

I have no problem with weird colors. What browser do you use?

by
by
by
by
by
by