imagelib.imageDimension.js 582 B

123456789101112131415161718
  1. console.log("Image Properties Access Test");
  2. //To test this, put a test.jpg on your desktop
  3. var imagePath = "user:/Desktop/test.jpg";
  4. //Check if the file exists
  5. requirelib("filelib");
  6. if (!filelib.fileExists(imagePath)){
  7. sendResp("File not exists!")
  8. }else{
  9. //Require the image library
  10. var loaded = requirelib("imagelib");
  11. if (loaded) {
  12. //Library loaded. Call to the functions
  13. var dimension = imagelib.getImageDimension(imagePath);
  14. sendJSONResp(JSON.stringify(dimension));
  15. } else {
  16. console.log("Failed to load lib: imagelib");
  17. }
  18. }