imagepicker.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*global cordova,window,console*/
  2. /**
  3. * An Image Picker plugin for Cordova
  4. *
  5. * Developed by Wymsee for Sync OnSet
  6. */
  7. var ImagePicker = function() {
  8. };
  9. /*
  10. * success - success callback
  11. * fail - error callback
  12. * options
  13. * .maximumImagesCount - max images to be selected, defaults to 15. If this is set to 1,
  14. * upon selection of a single image, the plugin will return it.
  15. * .width - width to resize image to (if one of height/width is 0, will resize to fit the
  16. * other while keeping aspect ratio, if both height and width are 0, the full size
  17. * image will be returned)
  18. * .height - height to resize image to
  19. * .quality - quality of resized image, defaults to 100
  20. */
  21. ImagePicker.prototype.getPictures = function(success, fail, options) {
  22. if (!options) {
  23. options = {};
  24. }
  25. var params = {
  26. maximumImagesCount: options.maximumImagesCount ? options.maximumImagesCount : 15,
  27. width: options.width ? options.width : 0,
  28. height: options.height ? options.height : 0,
  29. quality: options.quality ? options.quality : 100
  30. };
  31. return cordova.exec(success, fail, "ImagePicker", "getPictures", [params]);
  32. };
  33. window.imagePicker = new ImagePicker();