File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const path = require('path');
8
8
const pugTemplatePath = path . join ( __dirname , "../views/index.pug" ) ;
9
9
10
10
const app = express ( ) ;
11
+ app . use ( express . static ( 'static' ) )
11
12
app . use ( cors ( ) ) ;
12
13
app . set ( 'view engine' , 'pug' ) ;
13
14
Original file line number Diff line number Diff line change 1
1
html
2
2
body
3
+ img( id ="my-image" )
3
4
h3 Imagekit Demo
4
5
form( action ='#' onSubmit ='upload(event)' )
5
6
input( type ='file' id ='file1' )
18
19
p
19
20
img( src ="" )
20
21
21
- script( type ='text/javascript' src ="https://unpkg.com/imagekit-javascript/dist/imagekit.min.js" )
22
+ // Copy paste manually from dist
23
+ script( type ='text/javascript' src ="./imagekit.min.js" )
22
24
script .
23
25
try {
24
26
var imagekit = new ImageKit ({
25
27
publicKey: " !{publicKey}" ,
26
28
urlEndpoint: " !{urlEndpoint}" ,
27
29
});
28
30
31
+
29
32
window .imagekit = imagekit;
30
33
34
+ var url = imagekit .url ({
35
+ src: " https://ik.imagekit.io/demo/default-image.jpg" ,
36
+ transformation: [{
37
+ height: 100
38
+ }]
39
+ })
40
+
41
+ var img = document .getElementById (" my-image" );
42
+ console .log (url);
43
+ img .src = url;
44
+
31
45
32
46
function upload (e ) {
33
47
e .preventDefault ();
119
133
}
120
134
} catch (ex) {
121
135
console .log (ex);
122
- }
136
+ }
You can’t perform that action at this time.
0 commit comments