FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cloudinary_php/samples/edit-me.php at master · cloudinary/cloudinary_php · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
cloudinary
/
cloudinary_php
Public
Notifications
You must be signed in to change notification settings
Fork
151
Star
399
Code
Issues
4
Pull requests
3
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cloudinary_php
/
samples
/
edit-me.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
122 lines (111 loc) · 4.19 KB
Breadcrumbs
cloudinary_php
/
samples
/
edit-me.php
Copy path
File metadata and controls
122 lines (111 loc) · 4.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/**
* This file is part of the Cloudinary PHP package.
*
* (c) Cloudinary
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Cloudinary
\
Samples
;
require_once
__DIR__
.
'
/../vendor/autoload.php
'
;
require_once
__DIR__
.
'
/SamplePage/SamplePage.php
'
;
require_once
__DIR__
.
'
/SamplePage/Sample/TransformationSample.php
'
;
use
Cloudinary
\
ClassUtils
;
use
Cloudinary
\
Configuration
\
Configuration
;
use
Cloudinary
\
Transformation
\
Argument
\
Text
\
FontFamily
;
use
Cloudinary
\
Transformation
\
Argument
\
Text
\
FontWeight
;
use
Cloudinary
\
Transformation
\
Effect
;
use
Cloudinary
\
Transformation
\
Position
;
use
Cloudinary
\
Transformation
\
Resize
;
use
Cloudinary
\
Transformation
\
Source
;
use
Cloudinary
\
Transformation
\
TextStyle
;
use
Cloudinary
\
Transformation
\
Transformation
;
Configuration::
instance
([
'
cloud
'
=> [
'
cloud_name
'
=>
'
demo
'
]]);
$
sample
= [
'
name
'
=>
'
Sample
'
,
//group name
'
iconClass
'
=>
'
fas fa-camera
'
,
'
items
'
=> [
[
'
name
'
=>
'
Your Transformation
'
,
//subGroup name
'
items
'
=> [
[
(
new
Transformation
())
->
resize
(
Resize::
fill
(
220
,
140
)
)->
overlay
(
Source::
image
(
'
brown_sheep
'
)->
resize
(Resize::
fill
(
220
,
140
)),
Position::
center
(
220
)
)->
overlay
(
Source::
image
(
'
horses
'
)->
resize
(Resize::
fill
(
220
,
140
)),
Position::
center
(-
110
,
140
)
)->
overlay
(
Source::
image
(
'
white_chicken
'
)->
resize
(Resize::
fill
(
220
,
140
)),
Position::
center
(
110
,
70
)
)->
overlay
(
Source::
image
(
'
butterfly
'
)->
resize
(Resize::
scale
()->
height
(
200
))->
rotate
(
10
),
Position::
center
(-
10
)
)->
resize
(Resize::
crop
(
400
,
260
))
->
roundCorners
(
20
)
->
overlay
(
Source::
text
(
'
Memories from our trip
'
)
->
textStyle
((
new
TextStyle
(FontFamily::
PARISIENNE
,
35
))->
fontWeight
(FontWeight::
BOLD
))
->
textColor
(
'
#990C47
'
),
Position::
center
()->
offsetY
(
155
)
)->
effect
(Effect::
shadow
())
,
'
(new Transformation())
->resize(
Resize::fill(220, 140)
)->overlay(
Source::image(
\'
brown_sheep
\'
)->resize(Resize::fill(220, 140)),
Position::center(220)
)->overlay(
Source::image(
\'
horses
\'
)->resize(Resize::fill(220, 140)),
Position::center(-110, 140)
)->overlay(
Source::image(
\'
white_chicken
\'
)->resize(Resize::fill(220, 140)),
Position::center(110, 70)
)->overlay(
Source::image(
\'
butterfly
\'
)->resize(Resize::scale()->height(200))->rotate(10),
Position::center(-10)
)->resize(Resize::crop(400, 260))
->roundCorners(20)
->overlay(
Source::text(
\'
Memories from our trip
\'
)
->style((new TextStyle(FontFamily::PARISIENNE, 35))->fontWeight(FontWeight::BOLD))
->textColor(
\'
#990C47
\'
),
Position::center()->offsetY(155)
)->effect(Effect::shadow())
'
,
],
],
],
],
];
/**
* Converts arrays to TransformationSample
*
* @param $group
*
* @return mixed
*/
function
createSampleGroup
(
$
group
)
{
foreach
(
$
group
[
'
items
'
]
as
&
$
subGroup
) {
if
(!
isset
(
$
subGroup
[
'
publicId
'
])) {
$
subGroup
[
'
publicId
'
] =
isset
(
$
group
[
'
publicId
'
]) ?
$
group
[
'
publicId
'
] :
'
yellow_tulip
'
;
}
foreach
(
$
subGroup
[
'
items
'
]
as
&
$
sampleArray
) {
$
sampleArray
[] = (
$
subGroup
[
'
publicId
'
]);
$
sampleArray
= ClassUtils::
verifyVarArgsInstance
(
$
sampleArray
, TransformationSample::class);
}
}
return
$
group
;
}
$
page
=
new
SamplePage
(
'
PHP SDK v2 Transformation Sample
'
,
'
Cloudinary - PHP SDK v2 Transformation Samples
'
);
$
page
->
addGroup
(
createSampleGroup
(
$
sample
));
$
page
->
currentNavLink
=
2
;
echo
$
page
;
Back
|
FazBrowse Home
|
New Git URL