Media resizer
Download
Download
The problem:
You've got a client who wants to add video clips to their web pages. They are grabbing clips from all over the place; YouTube, Vimeo, Flickr. You've designed a beautiful template with space to accommodate a clip of a certain size. Your client adds an enormous, wide-screen movie and your template explodes.
The solution:
Get your template to scale the video clip to a size that you, the designer, can control so that it won't break the layout. You want the scaling to constrain the proportions of the clip, so people don't end up looking weirdly tall. You also want the scaling to be a robust process, performed on the sever, so that it will works in all environment and not just the latest browsers.
Media Resizer from Electric Putty is a free Expressionengine Plugin available for both EE1.x and EE2.x which does exactly this. Easy to install, you simple add the plugin's tag to your template where the video embed code will be placed. For example:
{exp:ep_media_resizer width="550"} {video_clip} {/exp:ep_media_resizer}
Parameters
- height: The desired height of the media object - if not specified the new height will be calculated automatically from the desired width
- width: The desired width of the media object - if not specified the new width will be calculated automatically from the desired height
- debug: If set to true the plugin will output the original and processed heights and widths of all the relevant DOM elements (object, embed, iframe).
NOTE: All parameters and optional but if neither height or width params are set the object will be returned at its original size. Also, embedded objects (iframe, embed, object) must have a default width and height set.
Media Resizer will work with any embedded media item such as a YouTube video, a Google Map or a SoundCloud audio player.
You can see an example of the Plugin in use here: http://www.skills-thirdsector.org.uk/media_library
Download
- V2.1 : EE1 & 2 — Download contains both EE1 & EE2 versions of EP Media Resizer v2.1
- V2.0 : EE1 & 2 — Download contains both EE1 & EE2 versions of EP Media Resizer v2.0
Changelog
V2.1 -- Fixed a bug that would cause EE to display a PHP warning if debug is set to '1'.
11 comments
AB
Would be really amazing if this also resized linked images that aren’t uploaded, especially in the forum module.
Similar idea: http://www.vbulletin.org/forum/showthread.php?t=118048
Lasse Muurinen
Hej !
- What is this ?
{exp:ep_media_resizer width=“70”}
Then ???
A PHP Error was encountered
Severity: Warning
Message: Division by zero
Filename: ep_media_resizer/pi.ep_media_resizer.php
Line Number: 236
Rob
Hi Lasse,
Can you please tell us what version of EE you’re using, what version of the plugin you’re using and most importantly, can you show us the snippet of code from the template where you’re trying to use the plugin.
Thanks,
Rob
Lasse Muurinen
EE 2.X
Lasse Muurinen
code
{exp:ep_media_resizer width=“70”}
<embed src=”{Video_tiedosto}” width=“auto” autoplay=“false” controller=“true” type=“video/quicktime” pluginspage=“http://www.apple.com/quicktime/download/”> </embed>
{/exp:ep_media_resizer}
and EE
v2.1.3 - © Copyright 2003 - 2010 EllisLab, Inc.
Script executed in 0.1148 seconds - 22 SQL queries used - Build: 20110411
Rob
Hi Lasse,
I’m going to email you an updated version, this *should* solve your problem. We did not anticipate anyone using ‘auto’ as a value in the actual embed tag (I’m not even sure if this is valid HTML!)
Please let us know if it works/doesn’t work
Thanks,
Rob
Lasse Muurinen
with the one I got from you 2.2.
1.
- Don´t find the video
{exp:channel:entries channel=“Videot” orderby=“random” limit=“1”}
<embed src=”{exp:ep_media_resizer width=“550”}{Video_tiedosto}{/exp:ep_media_resizer}” autoplay=“false” controller=“true” type=“video/quicktime” pluginspage=“http://www.apple.com/quicktime/download/”> </embed>
<div class=“kirjoit”> {title} </div>
{/exp:channel:entries}
2.
A PHP Error was encountered
Severity: Warning
Message: Division by zero
Filename: ep_media_resizer/pi.ep_media_resizer.php
Line Number: 236
{exp:channel:entries channel=“Videot” orderby=“random” limit=“1”}
{exp:ep_media_resizer width=“200”}
<embed src=”{Video_tiedosto}” autoplay=“false” controller=“true” type=“video/quicktime” pluginspage=“http://www.apple.com/quicktime/download/”> </embed>
{/exp:ep_media_resizer}
<div class=“kirjoit”> {title} </div>
{/exp:channel:entries}
Rob Hodges
Hi Lasse,
In your first example, that is the incorrect usage of the tag, so that’s why that didn’t work :)
In number 2, that is correct, but your <embed> tag needs to have a width and height on it, so that the resizer has something to work with. YouTube, Vimeo, Google Maps etc all provide their embed links with width and height preset, and a limitation of our plugin is that it can only *change* parameters, not *insert* them.
Please try using the code from example 2 and giving your embed a width and height.
Thanks!
Rob
Lasse
Sorry it´s not working :-(
{exp:ep_media_resizer width=“300”}
<embed src=”{Video_tiedosto}” height=“390px” width=“640px” autoplay=“false” controller=“true” type=“video/quicktime” pluginspage=“http://www.apple.com/quicktime/download/”> </embed>
{/exp:ep_media_resizer}
http://www.uusikaupunki.tv/index.php/Ne_Sivut/Videot
ps the code is now
{exp:ep_media_resizer width=“300”}
<embed src=”{Video_tiedosto}” height=“272” width=“430” autoplay=“false” controller=“true” type=“video/quicktime” pluginspage=“http://www.apple.com/quicktime/download/”> </embed>
{/exp:ep_media_resizer}
Rob
Are you still getting the PHP error? It looks fine to me, the only problem is that your movie that you’re embedding is ridiculously large in filesize so it’s taking ages to load.
Nathan
We are trying to use this plugin and are getting the following error:
Severity: Notice
Message: Undefined offset: 0
Filename: ep_media_resizer/pi.ep_media_resizer.php
Line Number: 169
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /mnt/target03/355825/640231/www.goodwillcmh.org/web/content/manage/codeigniter/system/core/Exceptions.php:170)
Filename: core/Common.php
Line Number: 409
Our Setup:
EE v2.3.1 - Build: date 20111017, EP_MR v 2.1