All Projects → wrav → oembed

wrav / oembed

Licence: MIT license
A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.

Programming Languages

PHP
23972 projects - #3 most used programming language
Twig
543 projects

Projects that are alternatives of or similar to oembed

picpuller-for-craft3
Pic Puller for Craft 3 lets authorized users pull in their Instagram media into Craft.
Stars: ✭ 12 (-64.71%)
Mutual labels:  instagram, craft, craftcms, craft-plugin
craft-instagram-feed
Craft CMS plugin to receive Instragram feed data as variable in templates
Stars: ✭ 25 (-26.47%)
Mutual labels:  instagram, craft, craftcms, craft-plugin
craft-audit
Audit log for Craft 3
Stars: ✭ 18 (-47.06%)
Mutual labels:  craft, craftcms, craft-plugin
Craft Brief
Quick, easy, and customizable user-group notifications for Craft CMS.
Stars: ✭ 47 (+38.24%)
Mutual labels:  craft, craftcms, craft-plugin
Craft Preparse Field
Field type that parses twig when an element is saved.
Stars: ✭ 103 (+202.94%)
Mutual labels:  craft, craftcms, craft-plugin
craft-plugin-mix
Helper plugin for Laravel Mix in Craft CMS templates
Stars: ✭ 50 (+47.06%)
Mutual labels:  craft, craftcms, craft-plugin
craft-entriessubset
Craft field type plugin that extends the core Entries field type to give extra settings
Stars: ✭ 27 (-20.59%)
Mutual labels:  craft, craftcms, craft-plugin
Buttonbox
A collection of utility field types for Craft
Stars: ✭ 94 (+176.47%)
Mutual labels:  craft, craftcms, craft-plugin
overflow.craft-plugin
A plain text Craft field type, with a soft or hard character limit.
Stars: ✭ 13 (-61.76%)
Mutual labels:  craft, craftcms, craft-plugin
Seo
SEO utilities including a unique field type, sitemap & redirect manager
Stars: ✭ 210 (+517.65%)
Mutual labels:  craft, craftcms, craft-plugin
Linkit
Multi-purpose link plugin for Craft CMS
Stars: ✭ 155 (+355.88%)
Mutual labels:  craft, craftcms, craft-plugin
tablemaker
A user-definable table field type for Craft CMS
Stars: ✭ 39 (+14.71%)
Mutual labels:  craft, craftcms, craft-plugin
craft.patrol
Patrol simplifies SSL and maintenance routing for sites built with Craft
Stars: ✭ 90 (+164.71%)
Mutual labels:  craft, craftcms, craft-plugin
craft-json-snippets
Helps make CraftCMS models in .json
Stars: ✭ 17 (-50%)
Mutual labels:  craft, craftcms, craft-plugin
Awesome
A collection of awesome Craft CMS plugins, articles, resources and shiny things.
Stars: ✭ 449 (+1220.59%)
Mutual labels:  craft, craftcms, craft-plugin
craft-entry-instructions
A simple fieldtype to add instructions.
Stars: ✭ 16 (-52.94%)
Mutual labels:  craft, craftcms, craft-plugin
Craft.patrol
Patrol simplifies SSL and maintenance routing for sites built with Craft
Stars: ✭ 91 (+167.65%)
Mutual labels:  craft, craftcms, craft-plugin
Simplemap
A beautifully simple map field type for Craft CMS.
Stars: ✭ 136 (+300%)
Mutual labels:  craft, craftcms, craft-plugin
smartdown.craft-plugin
Bringing the unbridled joy of Markdown Extra and Smartypants to your Craft websites.
Stars: ✭ 26 (-23.53%)
Mutual labels:  craft, craftcms, craft-plugin
craft-assetmetadata
Asset Metadata plugin for Craft CMS
Stars: ✭ 31 (-8.82%)
Mutual labels:  craftcms, craft-plugin

oEmbed plugin for Craft CMS 3.x

oEmbed

A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.

If use are looking for CraftCMS 2.5 support use previous project version 1.0.4 which is the latest release for CraftCMS 2.5.

Installing

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require wrav/oembed
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for oEmbed.

Using oEmbed

To use simply call one of the following methods on your field type

{{ entry.field.valid }} # Get the embed object
{{ entry.field.render }} # Renders HTML
{{ entry.field.embed }} # Get the embed object
{{ entry.field.media }} # Get the embed object

We also provide option to use as a Twig variable

{{ craft.oembed.valid(url, options) }}
{{ craft.oembed.render(url, options) }}
{% set embed = craft.oembed.embed(url, options) %}
{% set media = craft.oembed.media(url, options) %}

Updating the embed URL, such as autoplay, rel, mute paramaters. This allows for you to support features the provider might not yet support

{{ 
    entry.oembed_field.render({
        params: {
            autoplay: 1,
            rel: 0,
            mute: 0,
            loop: 1,
            autopause: 1,
        },
        attributes: {
            title: 'Main title',
            'data-title': 'Some other title',
        }
    }) 
}}

Updating the width & height attributes on the iframe can be done using the following method, however is CSS is still recommended view for sizing your iframe.

{{ 
    entry.oembed_field.render({
        width: 640,
        height: 480,
    }) 
}}

or

{{ 
    entry.oembed_field.render({
        attributes: {
            width: 640,
            height: 480,
        }
    }) 
}}

You can access additional media details using the examples below.

entry.field.media.title
entry.field.media.description
entry.field.media.url
entry.field.media.type
entry.field.media.tags
entry.field.media.images
entry.field.media.image
entry.field.media.imageWidth
entry.field.media.imageHeight
entry.field.media.code
entry.field.media.width
entry.field.media.height
entry.field.media.aspectRatio
entry.field.media.authorName
entry.field.media.authorUrl
entry.field.media.providerName
entry.field.media.providerUrl
entry.field.media.providerIcons
entry.field.media.providerIcon
entry.field.media.publishedDate
entry.field.media.license
entry.field.media.linkedData
entry.field.media.feeds

Additional Embed information can be found here

GraphQL

I recommend enabling caching in the plugin settings menu to speed up the API resolve timing.

Below is an example of a Oembed field called "foobar" add accessing properties from the embed object.

{
  entries {
    id,
    ... on page_page_Entry {
      foobar {
        code,
        providerUrl,
        aspectRatio
      }
    }
  }
}

Credits

Original built while working at HutSix I've since been granted permission to continue development here.

Change Log

Changes can be viewed here

Support

Get in touch via email, Discord, or by creating a Github issue

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].