Giter Club home page Giter Club logo

craft-embedded-assets's Introduction

Embedded Assets

Manage YouTube videos, Instagram photos, Twitter posts and more as first class assets

Embedded Assets is a Craft CMS plugin that lets you add YouTube videos, Instagram photos, Twitter posts and more to Craft's asset manager, and treat them as first class assets. Just open up your asset manager, paste in a URL and watch the magic happen.

Embed anything

Paste a URL to anything and Embedded Assets will pull all the images, embed codes and metadata it can from the page.



Just an asset

Embedded assets are just JSON files. This means they can exist as real assets within your assets folders. With a little bit of Twig magic the embed information can be accessed and used in your templates.



Documentation


Created by Benjamin Fleming
Maintained by Spicy Web

craft-embedded-assets's People

Contributors

adamskyle avatar arifje avatar awcross avatar benjamminf avatar boboldehampsink avatar dasunr avatar dependabot[bot] avatar engram-design avatar johndwells avatar leevigraham avatar maxfenton avatar mia-tpa avatar missmatsuko avatar mmikkel avatar pvldigital avatar scandella avatar toddprouty avatar ttempleton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

craft-embedded-assets's Issues

Error after upgrading to v0.2.0

First: Big thanks for an awesome plugin. My client loves it!

Today I upgraded to Version 0.2.0 and it produces the following error

Fatal error: Class 'Opengraph\Opengraph' not found in /var/www/craft/app/framework/YiiBase.php on line 213

Thanks

Error uploading the file: This file type is not allowed

Hey Ben.
Thanks so much for building this plugin. It's made it so much easier to get users to post YouTube videos correctly :)

First off I'm using:

  • Craft CMS 2.6.2940
  • Embedded Assets 0.3.4

Every time I try to upload/embed an embedded asset I get this following error "Error uploading the file: This file type is not allowed".

The field type in use is a completely unrestricted asset field. So this doesn't appear to be me being dumb (I hope). I've used the plugin on plenty of other sites previously without issue.

I've tried a few different examples:

All result in the same error.
Any ideas?

Thanks in advance.


Uploading/embedding a YouTube link
screen shot 2016-10-03 at 10 10 24 am

The error
screen shot 2016-10-03 at 10 10 29 am

Test asset field showing no restrictions on upload type
screen shot 2016-10-03 at 10 17 32 am

The safeHtml property returns String instead of html code

Hi there,

When I try to add the following code in my template to embed a youtube video, the iframe is just outputting the code as text on the screen instead of adding a iframe to the DOM

 {% set embeddedAsset = craft.embeddedAssets.fromAsset(block.video.first()) %}
 {% if embeddedAsset %}
        {{ embeddedAsset.safeHtml }}
 {% endif %}`

embedded

CP requests hang if there's an issue getting any thumbnail URLs

Hello,

I have this plugin installed and it has been working great on a site, but any CP request was taking well over a minute to load, if at all. After a bit of investigation I traced it to the EmbeddedAssetsModel::populateFromAsset() method, which I think is run for every embedded asset, on every non-Ajax CP request.

This attempts to read the .json file to get the thumbnail URL, but the file_get_contents() call has its errors suppressed with '@'. After removing that I found that a warning was/should have been triggered for one of the assets on our S3-backed asset source:

file_get_contents(https://ca1-tls.edcdn.com/embed_065cfea0-46ef-4683-98c2-4ab42f68973e.json?mtime=20160406103454): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden

Which is obviously not ideal in the first place, but because of the error suppression, PHP seemed to just stall, at least for a full minute, sometimes it doesn't load at all, and it's happening on every CP request, even for the login page.

Could there also be an issue with this if the client adds 1000 embedded assets, would every CP request make 1000 calls to S3 for those files?

Thanks for the plugin, and any help you can offer!

Video Thumbnail show JSON filetype

Is there a way to show the youtube Thumbnails in the Controlpanel.

The thumnails are showing at upload:
bildschirmfoto 2016-10-30 um 18 21 59

But they disappear at save:
bildschirmfoto 2016-10-30 um 18 22 06

Is this a Bug?

Craft CMS 2.6.2949 | PHP 7.0.12 | Embedded Assets 0.3.4

500 (Internal Server Error) on save

When I try to save a link I get /actions/embeddedAssets/saveEmbeddedAsset 500 (Internal Server Error)

The modal shows the preview just fine but I can not save at all.

PHP 7, Craft CMS 2.6.2903, MAMP, HTTPS

Why data is stored in JSON and not in a different table ?

Hi,
First thanks for this great plugin (and for Neo). I was wondering why you chose to store data in Json file instead of filling a seperate table. Isn't it too heavy for the server to get the Json file and then decode it, especially if you have to list for example 30 videos ?

Installation question

I am sorry to be dense but when i add this line:
'extraAllowedFileExtensions' => 'json'
to the file:
/craft/config/general.php
I get 500 errors.

Am i editing the correct file? Is there any additional info on the installation?
Appreciate any help you can provide. Thanks.

Can't install plugin

I've got this working great on my local php 5.5.17, but when deployed to our Digital Ocean dev site on php 5.4.45 the plugin will not install. Is this something you'd expect?

Handle duplicates in folder

Currently if enter the same url in the same folder, a duplicate is created.
Would be nice if it used the existing one if found.

Error uploading the file: This file type is not allowed

I have created an asset field, but when I try to add an embed link via the button, it gives me the error Error uploading the file: This file type is not allowed. Have no idea why as I have not set any restrictions on the field at all.

Json file is not converted anymore in Craft

Hey,

on my local and stage server the plugin didnt make any problems.
But now on the live site, the json files are not generated anymore to the video link file.

See the attached screenshots :) what could be the problem?
Something with my provider/server or database?

Best,
marcel

bildschirmfoto 2017-01-23 um 17 55 53

Thumbnail and URL not showing up in Assets

On my local dev server, the embedded assets look great in Assets, with a thumbnail and the original YouTube URL included (once I added the 'Filename' column, of course):
local server

On the staging server, they look like this:
staging server

Any idea what might cause this?

Plugin not working if asset source path contains environment variable

If asset source settings uses an environment variable inside path setup, then the plugin won't read the file as the path isn't parsed. In EmbeddedAssetsService function readAssetFile local asset path isn't parsed before calling realpath function. The issue is fixed by passing the path through craft()->config->parseEnvironmentString($path) before realpath.

Use of mime_content_type breaks on some systems

In services/EmbeddedAssetsService.php, mime_content_type() is used.

However, this function comes from a deprecated library and doesn't exist at all in some vendor builds of PHP 5.3+. This makes any attempt to upload an embedded asset fail silently on these systems, because mime_content_type() is undefined.

PHP Error

Hiya,

I'm trying to use Embedded Assets on an existing site - it's hosted on Windows (don't blame me). I've created a new Assets folder and I can upload images into it, but when I try to embed a video, I get a Unknown Error Occured red box appear at the top of the screen. The server PHP version is 5.5.11.

phperrors.log has this to say about it:

[01-Jun-2016 09:35:08 UTC] PHP Fatal error:  Call to undefined function Craft\finfo_open() in C:\Client_Sites\mysite.co.uk\craft\plugins\embeddedassets\services\EmbeddedAssetsService.php on line 250

I've got a yellow warning triangle next to fileinfo extension on Utils. Could that be it?

Thanks,
Daryl

safeHtml strips allowfullscreen attribute

First, awesome plugin!

Second, I'm not sure if this is intentional or not, but safeHtml seems to be stripping some useful attributes that might be included in the original json response.

For example, if you add a YouTube video, the returned json has...
html: "html": "\u003ciframe width=\"459\" height=\"344\" src=\"https:\/\/www.youtube.com\/embed\/iwGFalTRHDA?feature=oembed\" frameborder=\"0\" allowfullscreen\u003e\u003c\/iframe\u003e"

But, when you use safeHtml|raw to output, the allowfullscreen is gone...
<iframe width='1280' height='720' src='https://www.youtube.com/embed/AXaiBz7QOpY?feature=oembed' frameborder='0'></iframe>

I'm assuming it gets stripped out because it doesn't have an ="..."?

At the end of the day, for my use-case, its not a deal-breaker. But, figured it was worth mentioning.

Please add FlowPlayer.org to whitelist

Hi,
I really like the plugin, could you please add support for flowplayer? It's most likely just the whitelist that needs updating - I'm fairly certain flowplayer should embed due to its wide range of formats and embedding options. It provides a lot of control over how the video displays etc.

many thanks

"Umlaut" in entry slug causes 'HTMLPurifier_Config' not found error

Hi there. May have found a bug

When the plugin is installed and an entry's slug contains an Umlaut (such as ä,ö,ü) visiting the entry inside the CP results in the following error

Fatal error: Class 'HTMLPurifier_Config' not found in /var/www/craft/plugins/embeddedassets/services/EmbeddedAssetsService.php on line 37

The error goes away by

  • deactivating the plugin or
  • changing the URL in the browser adress bar from e.g. "admin/entries/sectionname/242-ääää" to "admin/entries/sectionname/242-somethingelse" or
  • changing the entry slug to not contain an umlaut

Parameters Missing

I added a parameter (showinfo=0) to the plugins settings page with the goal to hide youtubs info bar. Unfortunately this doesn't work and the bar is still there. When I check the request in the browser console the parameter is missing.

Any ideas what I'm missing?

Cheers, Pascal.

Support for YouTube embed ID as a parameter

Hi there,

Love the add-on, but having an issue with a modal plugin where it wants youtube URL in this format:

https://www.youtube.com/embed/<video ID>

Is it possible for you to add another parameter to the output options? I was trying to work it out myself but got nowhere :(

Thanks,

Rob

Unable to use CURL - can I work around?

Hey Ben.
Sorry I know this isn't quite the right venue for a question.

Due to a technical limitation with the way my hosting works (a bunch of docker images with an nginx proxy on front etc), I can't use CURL over https.

When the plugin is just used for Youtube/Vimeo Is it safe to drop the CURL request from EmbeddedAssetsService->_readExternalFile() and rely just on the file_get_contents() call?

It's just referencing a local json file so I'm thinking yes. You're obviously more familiar with what that might explode as a result though.

Thanks.

500 Error, asset URL doesn't resolve

Embedded Assets is working fine on my local dev machine. When I try to add a YouTube link on my staging domain though, I paste a URL into the bar:

screen shot 2016-04-28 at 10 43 57

I just see a wheel turning constantly as if it's continually processing. In the console, I'm seeing the following error:

error

Any ideas?

Impossible to access an attribute ("safeHtml") on a null variable

Everything works fine locally (running in Vagrant) but for some reason, suddenly this plugin is failing on the live server when it was all working fine previously.

For example, I have an entry with a video field, restricted to one selection. The code below works fine locally but on the server I get Impossible to access an attribute ("safeHtml") on a null variable

Code: {{craft.embeddedAssets.fromAsset(entry.video[0]).safeHtml|raw}}

I've triple checked that entry.video[0] is returning a valid AssetFileModel and it is working as expected. The JSON is accessible, so I don't think there are permissions issues anywhere.

Everything is up-to-date and the server meets the minimum php requirements, etc.

How can I debug this?

Implement a "safe HTML" approach

The most obvious way to output embedded assets to the frontend is just by outputting the html property.

Currently there is no HTML sanitation process so this relies on the user embedding assets that are known to be safe. This is not usually an issue as clients will typically only embed from YouTube. That said it's a glaring security issue that should be corrected.

The problem is it's really impossible to know if something is malicious. An idea would be to include an optional function that uses something like https://github.com/felixgirault/multiplayer to bypass using the provided HTML and build it itself for more popular providers.

Maybe I'm over thinking it, and stripping out all Javascript is the way to go.

Translation

Hi,

Is it possible to translate this plugin?
If so I would like to make the translation to Dutch.

Embedded Asset Not Found On HTTPS

Hi Ben.
Thanks for the amazing plugin. Clients love it :)

I've just enabled SSL on a site I'm working on and assets from YouTube have stopped being found.

First off, my twig code:

{% if asset is defined %}
    {% set embed = craft.embeddedAssets.fromAsset(asset) %}
    {% if embed %}
        {{ embed.safeHtml|raw }}
    {% endif %}
{% endif %}

This outputs fine on HTTP, but nothing on HTTPS.

I've started digging and in EmbeddedAssetsService->getEmbeddedAsset(), it tries to load up the embed:

$embed = EmbeddedAssetsModel::populateFromAsset($asset);

$asset is a valid AssetFileModel, but that returns null. I'll update the ticket as I find more.


Craft CMS 2.6.2903 | Embedded Assets 0.3.3

Embedded Assets doesn't account for json files in subfolders

If you have a Local Files assets type, use Embedded Assets and in Assets put the item into a subfolder, Embedded Assets still tries to access it at the root level (e.g. /assets/dogs/yaddayadda.json versus /assets/yaddayadda.json).

If there are any substantial number of Embedded Assets files in folders, this can slow the control panel down by 30+ seconds because it tries to load each at the root level and gets 404s instead of json files.

Uncaught TypeError

I'm having trouble getting the plugin to save videos with 0.2.0.... I keep getting an Uncaught TypeError. I can search for videos fine, but trying to save brings up this error:

Uncaught TypeError: Cannot read property 'id' of undefined EmbeddedAssets.js:49

This is on a localhost (WAMP) server, Craft 2.5.2761

Thanks!

YouTube Thumbnails

Hey there,

Thanks for such a great tool!

I am trying to display the YouTube thumbnails, but I'd like to use an image transform on them. Is that at all possible since the thumbnail url is a string?

Thx,
D.

No Fullscreen at Vimeo and Youtube on default

Hey,

i am adding the videos by help of the code:
{{ embed.safeHtml|raw }}

Soo far so fine, but for Vimeo and YouTube Videos no Fullscreen is available.
Is there a possibility? For example something i can put into the parameters in the plugin settings in craft itself?

Best Regards,
Marcel

Request: Output original url

Hello,

Would it be possible to output the original url.

For example

{{ media.rootUrl }} === 'https://vimeo.com/44061751'

Thanks

Can local assets be read locally instead of via remote URL

Hi,

In our particular live hosting environment the website can't curl it's self unless you do something like the following:

curl --header "host: website.com" http://123.123.123.123/path

Which meant that when we moved our site to the live URL it didn't work and it took a while to figure out why.

Is there any way for local assets it could just do something like a file_get_contents to the local path?

Also, related, there is no cURL timeout set so the page was down for good!

Thanks

All youtube video error with "Could not find any embeddable media from this URL"

Firstly, thanks for the plugin which has been working great ... until recently. Coming back to a project I was working on I am unable to add any youtube files. Any variation of the link gives the error "Could not find any embeddable media from this URL". This includes trying to re-add videos I have previously added or any random test. Previously embedded video currently in my asset folders work fine. Adding new vimeo embeds also works, just no youtube. Updated to 0.3.4 to see if it helped, but did'nt. Is this a known issue?

Ability to edit embedded asset in asset editor

Currently double-clicking an embedded asset to edit will show the standard element editor modal.

I'd like to add functionality that interfaces with embedded assets, where the filename field is the URL of the embedded asset, which will also support changing this field.

Not rendering after moving files & db to new server

First - thanks for the plugin! This will be a lifesaver on my current project. Lots of different embeds throughout the blog especially.

The problem I'm encountering:
I moved my asset folders from my local site to my staging server and imported the database. They show up in the asset library and on the entries I've added them to in the CP but the template doesn't render any of them and I get this error:

Impossible to access an attribute ("html") on a null variable

Local and remote are both PHP 7 and Craft CMS 2.6.2931

Memory limit includeResources/_getThumbnails

I bet you realize this already, but you can pretty easily run into memory limit issues if you have a lot of embedded assets.

I had this running on a production server, which had a little over 1000.

When I pulled the db down, I could no longer get into the CP at all, which I eventually tracked down to a memory limit by JsonHelper::encode($this->_getThumbnails()) called from EmbeddedAssetsPlugin::includeResources.

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.