When I upload an image, it adds a sequence of letters, numbers, and characters in the URL. I would like to know how do I change this, type, rather than appears this much of characters, simply appear the link of the image.
Here is the JavaScript code I'm using:
$(document).on('change', '#image-upload', function(evt) {
var files = evt.target.files; // FileList object
// Loop through the FileList and render image files as thumbnails.
for (var i = 0, f; f = files[i]; i++) {
// Only process image files.
if (!f.type.match('image.*')) {
continue;
}
var reader = new FileReader();
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
// Render thumbnail.
var span = document.createElement('span');
span.innerHTML =
'<a href="javascript:;" class="add-image"><img width="100px" height="100px" class="image-thumb" src="' + e.target.result + '" title="' + escape(theFile.name) + '"/></a>'
;
$("#memes-custom").append(span);
};
})(f);
// Read in the image file as a data URL.
reader.readAsDataURL(f);
}
});