Skip to content

Instantly share code, notes, and snippets.

@jagjeetgit
Created June 5, 2018 04:42
Show Gist options
  • Save jagjeetgit/6009e66e7b9c110e51a151fb52ff3f78 to your computer and use it in GitHub Desktop.
Save jagjeetgit/6009e66e7b9c110e51a151fb52ff3f78 to your computer and use it in GitHub Desktop.
Value commit script for Image Field Integration with DOR
function readImage (file) {
var reader = new FileReader();
reader.addEventListener("load", function (e) {
$(".guide-fu-fileItemList").hide();
var image = new Image();
$(".photo-upload .preview .imageP").remove();
$(".photo-upload .preview .text").remove();
image.width = 170;image.height = 220;
image.className = "imageP";
image.addEventListener("load", function () {
$(".photo-upload .preview")[0].prepend(this);
AFBBindedImage.value = e.target.result.substr(23);
});
image.src = window.URL.createObjectURL(file);
});
reader.readAsDataURL(file);
}
readImage($(this.fileList[0])[0].files[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment