4
4
5
5
6
6
import {
7
- Cloudinary , Util , Configuration , Transformation , ImageTag , PictureTag , VideoTag , Condition , Layer , TextLayer , HtmlTag ,
7
+ Cloudinary , Util , Configuration , Transformation , ImageTag , VideoTag , Layer , TextLayer , HtmlTag ,
8
8
ClientHintsMetaTag , Param
9
9
} from './cloudinary-core' ;
10
10
11
- import cloudinary from './cloudinary-core' ;
12
11
13
12
let config : Configuration . Options = { cloud_name : 'demo' } ;
14
13
@@ -26,11 +25,9 @@ cld.injectTransparentVideoElement(document.createElement('div'), 'woman', {
26
25
seeThruURL : 'https://...'
27
26
} ) . then ( ( resp ) => {
28
27
if ( resp instanceof HTMLElement ) {
29
- let container = resp ; // the container we provided
30
28
}
31
29
} ) . catch ( ( resp ) => {
32
30
if ( typeof resp . status === 'string' ) {
33
- let { status, message} = resp ;
34
31
}
35
32
} ) ;
36
33
@@ -74,13 +71,13 @@ cld.url('sample', {
74
71
} ) // http://res.cloudinary.com/demo/image/upload/if_w_lt_200,c_fill,h_120,w_80/if_w_gt_400,c_fit,h_150,w_150/e_sepia/sample
75
72
76
73
const publicId = 'imagePublicId' ;
77
- let image : HTMLImageElement = cld . image ( publicId ) ; // image.src == http://res.cloudinary.com/demo/image/upload/${publicId}
74
+ cld . image ( publicId ) ; // image.src == http://res.cloudinary.com/demo/image/upload/${publicId}
78
75
79
76
80
- let video : string = cld . video ( publicId ) ; // video == <video poster="http://res.cloudinary.com/demo/video/upload/${publicId}.jpg"><source src="http://res.cloudinary.com/demo/video/upload/${publicId}.webm" type="video/webm"><source src="http://res.cloudinary.com/demo/video/upload/${publicId}.mp4" type="video/mp4"><source src="http://res.cloudinary.com/demo/video/upload/${publicId}.ogv" type="video/ogg"></video>
77
+ cld . video ( publicId ) ; // video == <video poster="http://res.cloudinary.com/demo/video/upload/${publicId}.jpg"><source src="http://res.cloudinary.com/demo/video/upload/${publicId}.webm" type="video/webm"><source src="http://res.cloudinary.com/demo/video/upload/${publicId}.mp4" type="video/mp4"><source src="http://res.cloudinary.com/demo/video/upload/${publicId}.ogv" type="video/ogg"></video>
81
78
82
79
83
- const videoTag : VideoTag = cld . videoTag ( publicId ) ; // videoTag.getOption('source_types')) == ['webm', 'mp4', 'ogv']
80
+ cld . videoTag ( publicId ) ; // videoTag.getOption('source_types')) == ['webm', 'mp4', 'ogv']
84
81
85
82
86
83
cld . transformation_string ( {
@@ -118,12 +115,12 @@ transformation.serialize();
118
115
transformation . toHtmlAttributes ( ) ;
119
116
120
117
121
- let url : string = cld . url ( 'sample' , cld . transformation ( ) . if ( ) . width ( 'gt' , 100 ) . and ( ) . width ( 'lt' , 200 ) . then ( ) . width ( 50 ) . crop ( 'scale' ) . endIf ( ) ) ; // http://res.cloudinary.com/demo/image/upload/if_w_gt_100_and_w_lt_200/c_scale,w_50/if_end/sample
118
+ // let url: string = cld.url('sample', cld.transformation().if().width('gt', 100).and().width('lt', 200).then().width(50).crop('scale').endIf()); // http://res.cloudinary.com/demo/image/upload/if_w_gt_100_and_w_lt_200/c_scale,w_50/if_end/sample
122
119
123
120
124
- url = cld . url ( 'sample' , cld . transformation ( ) . if ( ) . width ( "gt" , 100 ) . and ( ) . width ( "lt" , 200 ) . then ( ) . width ( 50 ) . crop ( "scale" ) . endIf ( ) ) ; // http://res.cloudinary.com/demo/image/upload/if_w_gt_100_and_w_lt_200/c_scale,w_50/if_end/sample
121
+ cld . url ( 'sample' , cld . transformation ( ) . if ( ) . width ( "gt" , 100 ) . and ( ) . width ( "lt" , 200 ) . then ( ) . width ( 50 ) . crop ( "scale" ) . endIf ( ) ) ; // http://res.cloudinary.com/demo/image/upload/if_w_gt_100_and_w_lt_200/c_scale,w_50/if_end/sample
125
122
126
- url = cld . url ( 'sample' , cld . transformation ( ) . if ( ) . width ( "gt" , 100 ) . and ( ) . width ( "lt" , 200 ) . then ( ) . width ( 50 ) . crop ( "scale" ) . else ( ) . width ( 100 ) . crop ( "crop" ) . endIf ( ) ) ; // http://res.cloudinary.com/demo/image/upload/if_w_gt_100_and_w_lt_200/c_scale,w_50/if_else/c_crop,w_100/if_end/sample
123
+ cld . url ( 'sample' , cld . transformation ( ) . if ( ) . width ( "gt" , 100 ) . and ( ) . width ( "lt" , 200 ) . then ( ) . width ( 50 ) . crop ( "scale" ) . else ( ) . width ( 100 ) . crop ( "crop" ) . endIf ( ) ) ; // http://res.cloudinary.com/demo/image/upload/if_w_gt_100_and_w_lt_200/c_scale,w_50/if_else/c_crop,w_100/if_end/sample
127
124
128
125
129
126
transformation = cld . transformation ( ) . if ( "w > 1000 and aspectRatio < 3:4" )
@@ -132,21 +129,21 @@ transformation = cld.transformation().if("w > 1000 and aspectRatio < 3:4")
132
129
. else ( )
133
130
. width ( 500 )
134
131
. crop ( "scale" ) ;
135
- url = cld . url ( 'sample' , transformation ) ; // http://res.cloudinary.com/demo/image/upload/if_w_gt_1000_and_ar_lt_3:4,c_scale,w_1000/if_else,c_scale,w_500/sample
132
+ cld . url ( 'sample' , transformation ) ; // http://res.cloudinary.com/demo/image/upload/if_w_gt_1000_and_ar_lt_3:4,c_scale,w_1000/if_else,c_scale,w_500/sample
136
133
137
134
138
- image = cld . facebook_profile_image ( 'officialchucknorrispage' ,
135
+ cld . facebook_profile_image ( 'officialchucknorrispage' ,
139
136
{
140
137
secure : true ,
141
138
responsive : true ,
142
139
effect : [ 'art' , 'hokusai' ]
143
140
} ) ; // image.src == https://res.cloudinary.com/demo/image/facebook/e_art:hokusai/officialchucknorrispage && image.getAttribute('data-src-cache') == expectedImageUrl
144
141
145
142
146
- let tag = ImageTag . new ( "publicId" ) ;
143
+ ImageTag . new ( "publicId" ) ;
147
144
148
145
149
- let videoHtml = cld . videoTag ( "movie" ) . setSourceTypes ( 'mp4' )
146
+ cld . videoTag ( "movie" ) . setSourceTypes ( 'mp4' )
150
147
. transformation ( )
151
148
. htmlHeight ( "100" )
152
149
. htmlWidth ( "200" )
0 commit comments