@@ -64,7 +64,7 @@ function pdfannotator_display_embed($pdfannotator, $cm, $course, $file, $page =
64
64
// Load and execute the javascript files.
65
65
$ PAGE ->requires ->js (new moodle_url ("/mod/pdfannotator/shared/pdf.js?ver=00002 " ));
66
66
$ PAGE ->requires ->js (new moodle_url ("/mod/pdfannotator/shared/textclipper.js " ));
67
- $ PAGE ->requires ->js (new moodle_url ("/mod/pdfannotator/shared/index.js?ver=00034 " ));
67
+ $ PAGE ->requires ->js (new moodle_url ("/mod/pdfannotator/shared/index.js?ver=00035 " ));
68
68
$ PAGE ->requires ->js (new moodle_url ("/mod/pdfannotator/shared/locallib.js?ver=00005 " ));
69
69
70
70
// Pass parameters from PHP to JavaScript.
@@ -227,21 +227,22 @@ function pdfannotator_split_content_image($content, $res, $itemid, $context=null
227
227
$ data ['filepath ' ] = $ tempinfo ['filepath ' ];
228
228
$ data ['filesize ' ] = $ tempinfo ['filesize ' ];
229
229
$ data ['imagestorage ' ] = 'intern ' ;
230
+ preg_match ('/height=[0-9]+/ ' , $ imgstr , $ height );
231
+ $ data ['imageheight ' ] = str_replace ("\"" , "" , explode ('= ' , $ height [0 ])[1 ]);
232
+ preg_match ('/width=[0-9]+/ ' , $ imgstr , $ width );
233
+ $ data ['imagewidth ' ] = str_replace ("\"" , "" , explode ('= ' , $ width [0 ])[1 ]);
230
234
} else if (!str_contains ($ CFG ->wwwroot , $ url [0 ])){
231
235
$ data ['imagestorage ' ] = 'extern ' ;
232
236
$ data ['format ' ] = $ format [0 ];
237
+ $ imagemetadata = getimagesize ($ url [0 ]);
233
238
$ data ['image ' ] = 'data:image/ ' . $ format [0 ] . ";base64, " . base64_encode (file_get_contents ($ url [0 ]));
234
- // $data['image'] = $url[0];
239
+ $ data ['imagewidth ' ] = $ imagemetadata [0 ];
240
+ $ data ['imageheight ' ] = $ imagemetadata [1 ];
235
241
} else {
236
242
$ data ['success ' ] = "error " ;
237
243
$ data ['message ' ] = "cannot load image " ;
238
244
}
239
245
240
- preg_match ('/height=[0-9]+/ ' , $ imgstr , $ height );
241
- $ data ['imageheight ' ] = str_replace ("\"" , "" , explode ('= ' , $ height [0 ])[1 ]);
242
- preg_match ('/width=[0-9]+/ ' , $ imgstr , $ width );
243
- $ data ['imagewidth ' ] = str_replace ("\"" , "" , explode ('= ' , $ width [0 ])[1 ]);
244
-
245
246
$ res [] = $ firststr ;
246
247
$ res [] = $ data ;
247
248
$ content = $ laststr ;
0 commit comments