Giter VIP home page Giter VIP logo

modx-oembed's Introduction

oEmbed for MODX

Embed videos and photos into MODX sites using the oEmbed autodiscover protocol. Forked from the original oEmbed 0.2.1-beta MODX Extra that has a broken transport package.

oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.

Usage

Upload the transport package into your MODX site and install the oEmbed Extra.

Embed a video into your page/template using the oembed snippet:

[[oembed? &url=`http://www.youtube.com/watch?v=dQw4w9WgXcQ`]]

Remember to call the snippet cached - otherwise it'll be trying to find the video each time the page loads.

Options

Use the following options:

Parameter Description Default
&strictMatch Embedded URL can have parameters false
&maxWidth Sets width of container 600
&maxHeight Sets height of container 600
&format Sets response format (JSON or XML) json
&outputMode Output just the embed response or wrap with extra HTML code full
&discover Search for an embed URL false
&tpl (Optional) Use a custom chunk to display content
&url URL of what you want to embed

Placeholders

The following placeholders are available in your custom template chunks:

Placeholder Description
[[+embed]] Outputs the main <embed> content
[[+title]] Title of the embedded media
[[+author_url]] Link to media author's profile
[[+author_name]] Media author's name
[[+wrapperWidth]] From snippet call
[[+wrapperHeight]] From snippet call

CSS Classes

Useful for if you're targeting videos or other items with something like http://fitvidsjs.com/.

CSS class Item
.oembed Applied to all templates
.oembed-photo Photo media
.oembed-video Video media
.oembed-rich Rich media
.oembed-link URL media

Supported Sites

  • YouTube
  • BlipTV
  • Vimeo
  • Daily Motion
  • Flickr
  • Hulu
  • Viddler
  • Qik
  • Revision 3
  • Photobucket
  • Scribd
  • Wordpress TV

Todo

  • Add alternative to silent failing for errors, e.g. YouTube "Unauthorized"
  • Update the list of supported services
  • Replace the version that's in the MODX Extras listing with this version
  • Switch over to NoEmbed

Credits

Many thanks to atma for the original implementation.

Licence

Code is available under GPLv2 licence.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.