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');
88const pugTemplatePath = path . join ( __dirname , "../views/index.pug" ) ;
99
1010const app = express ( ) ;
11+ app . use ( express . static ( 'static' ) )
1112app . use ( cors ( ) ) ;
1213app . set ( 'view engine' , 'pug' ) ;
1314
Original file line number Diff line number Diff line change 11html
22 body
3+ img( id ="my-image" )
34 h3 Imagekit Demo
45 form( action ='#' onSubmit ='upload(event)' )
56 input( type ='file' id ='file1' )
1819 p
1920 img( src ="" )
2021
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" )
2224 script .
2325 try {
2426 var imagekit = new ImageKit ({
2527 publicKey: " !{publicKey}" ,
2628 urlEndpoint: " !{urlEndpoint}" ,
2729 });
2830
31+
2932 window .imagekit = imagekit;
3033
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+
3145
3246 function upload (e ) {
3347 e .preventDefault ();
119133 }
120134 } catch (ex) {
121135 console .log (ex);
122- }
136+ }
You can’t perform that action at this time.
0 commit comments