Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cloudinary
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
cloudinary
Commits
e732a416
Commit
e732a416
authored
2 years ago
by
Oleksandr Kuzava
Browse files
Options
Downloads
Patches
Plain Diff
Improve detecting cloudinary video.
parent
1a04c978
Branches
2.x
Branches containing commit
Tags
2.0.0-alpha5
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/cloudinary_video/src/Plugin/video_embed_field/Provider/Cloudinary.php
+10
-11
10 additions, 11 deletions
...ideo/src/Plugin/video_embed_field/Provider/Cloudinary.php
with
10 additions
and
11 deletions
modules/cloudinary_video/src/Plugin/video_embed_field/Provider/Cloudinary.php
+
10
−
11
View file @
e732a416
...
...
@@ -43,7 +43,7 @@ class Cloudinary extends ProviderPluginBase {
* The video format.
*/
protected
function
getVideoFormat
()
{
$info
=
pathinfo
(
$this
->
get
Input
());
$info
=
pathinfo
(
$this
->
get
VideoId
());
return
$info
[
'extension'
];
}
...
...
@@ -93,9 +93,7 @@ class Cloudinary extends ProviderPluginBase {
* {@inheritdoc}
*/
public
function
getRemoteThumbnailUrl
()
{
[,
$uri
]
=
explode
(
'://'
,
$this
->
getInput
());
$source
=
str_replace
(
".
{
$this
->
getVideoFormat
()
}
"
,
'.jpg'
,
$uri
);
$source
=
str_replace
(
".
{
$this
->
getVideoFormat
()
}
"
,
'.jpg'
,
$this
->
getVideoId
());
$options
[
'secure'
]
=
TRUE
;
$options
[
'resource_type'
]
=
'video'
;
...
...
@@ -113,7 +111,7 @@ class Cloudinary extends ProviderPluginBase {
* The url to use for remote video.
*/
public
function
getRemoteVideoUrl
()
{
[,
$source
]
=
explode
(
'://'
,
$this
->
get
Input
()
);
$source
=
$this
->
get
VideoId
(
);
$options
[
'secure'
]
=
TRUE
;
$options
[
'resource_type'
]
=
'video'
;
...
...
@@ -293,15 +291,16 @@ class Cloudinary extends ProviderPluginBase {
* {@inheritdoc}
*/
public
static
function
getIdFromInput
(
$input
)
{
[,
$source
]
=
explode
(
'://'
,
$input
,
2
);
if
(
preg_match
(
'/^(.+)\.(.+)$/'
,
$source
,
$matches
))
{
return
$matches
[
1
];
// Get public id from the video schema.
if
(
str_contains
(
$input
,
'cloudinary://'
))
{
return
substr
(
$input
,
strlen
(
'cloudinary://'
));
}
\Drupal
::
messenger
()
->
addError
(
'We could not fetch id from the video URL.'
);
if
(
str_contains
(
$input
,
'/video/upload/'
))
{
\Drupal
::
messenger
()
->
addWarning
(
t
(
'External cloudinary URL is currently not supported.'
));
}
return
''
;
return
FALSE
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment