Comments (10)
@maxfenton I have updated with v3.0.2. The core package embed/embed
seems to have changed a ton of keys and such and I'm using a ton of fallback mappings.
This is a fallback hack BUT if you have images with any particular URL and provider sites just let me know.
from oembed.
@maxfenton This is because the image is the same just has a high res and standard res. This will be a embed/embed
issue they choose, this why I've just given a fallback so code isn't breaking.
As for ddev craft update all
I would personally never do that but that'd because I don't trust things lol but I looked up the docs, as I use a standard custom Dockerfile, but you can just use ddev composer update
or ddev composer update wrav/oembed
this will not update your plugins major versions which IMHO is very bad that that is the case.
You will still have to set the composer.json to "wrav/oembed": "2.*",
manually to revert BUT it shouldn't impact your site as there isn't any custom SQL used. That said always test in a DEV environment.
I'll still be fixing v2.x-dev for bit longer but anything major feature wise will go to v3
aka master
branch
from oembed.
@reganlawton I finally realized there was an easy enough fix for what I was trying to do, using the media.images
you added above:
{#
Note about thumbnailUrl logic:
- check if the author has set an image in Craft
- else check if oEmbed v3 has provided a video thumbnail
-- iff the thumbnail contains `hqdefault` then it is a youtube video and we want the bigger image
- if neither of those are present, use the fallback
#}
{% set thumbnailUrl = (subblock.featuredImage.one().url ?? null)
??? (subblock.video.media.images[0] ?? null) | replace('hqdefault', 'maxresdefault')
??? '/assets/images/video-fallback.jpg' %}
I saw the update on #144 and thought I should come post this. Thank you for the fix above. It didn't get me the full list of YouTube thumbnails, but I can hack it with a string replace.
And now I can update to v3 of the plugin without breaking anything. :)
from oembed.
This is a breaking change: 273ed21
from oembed.
@maxfenton Thats why it was set to v3.0.0 a major release, normal used for breaking change or major changes.
The core package was completely upgraded to unblock other plugins that were needing embed/embed
v4.
I do understand that some things may have changed but that is due to relying on the core package embed/embed
.
I will update the doc in the README to reflect this but v2 of this plugin will still get bugfixes. New features will continue to v3+
from oembed.
@reganlawton Is there a plan to add entry.field.media.images
and other existing API data to this plugin? We have code that relies on entry.field.media.images
and then picks the largest image as a placeholder for videos.
from oembed.
Also, I think Craft has a way to mark a plugin version as needing some specific change or approval. At the moment craft update all
will go straight from 2.3.0 to 3.0.1 despite it being a major semver update.
from oembed.
So in this example, the thumbnail image for a video preview is set by first a custom field the author can edit, then by the largest of the images in oEmbed's entry.field.media.images
array (or the first one), and then a fallback image.
{% if videoThumbnail %}
{% set video = video | merge({
thumbnail: videoThumbnail,
}) %}
{% elseif (subblock.video.media.images ??? false) %}
{% set videoThumbnails = subblock.video.media.images | multisort('size', direction=SORT_DESC) %}
{% set videoThumbnail = videoThumbnails | filter(image => image.width / image.height == 16/9)[0] ?? videoThumbnails[0] ?? null %}
{% set video = video | merge({
thumbnailUrl: videoThumbnail ? videoThumbnail.url : videoThumbnailFallbackUrl,
}) %}
{% else %}
{% set video = video | merge({
thumbnailUrl: videoThumbnailFallbackUrl,
}) %}
{% endif %}
With oEmbed 2.3.0, the logic above would take the video https://www.youtube.com/watch?v=Limpr1L8Pss and provide https://i.ytimg.com/vi/Limpr1L8Pss/maxresdefault.jpg as the preview image, but now .images
doesn't exist.
Edit: I will try 3.0.2, thank you
from oembed.
Have you tried the latest version v3.0.2 I believe
from oembed.
This is the output of {% dd(subblock.video.media.images) %}
with 2.3.0:
And this is the output of {% dd(subblock.video.media.images) %}
with 3.2.0:
Is there any way in the CraftCMS plugin to set a mark for a breaking change that doesn't automatically update? ddev craft update all
tries to update oembed 2.3.0 => 3.0.3
despite the composer.json being specifically set to ^2.3.0
from oembed.
Related Issues (20)
- Cache tweets HOT 2
- Further changes required for GDPR compliance HOT 4
- Video preview very small HOT 2
- Division by zero error in both backend and frontend HOT 4
- ignores time #t=1m12s HOT 4
- Vimeo URLs not working (when video is set to be hidden on Vimeo.com) HOT 1
- Field always renders as if it has content HOT 2
- Field causes template to crash if left blank HOT 3
- Issue when using oEmbed in Vizy block HOT 3
- Additional data missing for media objects HOT 11
- How do we get the media data with the new update? HOT 7
- Looping a video HOT 6
- YT/Vimeo media URL blank after upgrading to 3.x HOT 3
- Google Maps Error: www.google.com refused to connect HOT 1
- Large quantities of embed-cookies-{uid} are being created, but not deleted? HOT 1
- possible to display Youtube thumbnail before user gives cookie consent? HOT 2
- Vimeo URLs not working in any environment HOT 28
- GrapQL - Error when querying an entry with a empty oEmbed URL
- oEmebed resources not loaded in Craft Cloud environment HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oembed.