Im loocking for some implementation of jquery that I cannot find that fit my requierements.
I need to upload a image from my PC, and be able to change the background colo, as I do (im supposed to use png images with transparent parts).
I could like to be able to add some icons and text over the image I have uploaded at the browser that I can allready manage.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script src=
"http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" type=
"text/javascript"></script>
<script>
$(document).ready(function() {
$("#color").change(function(){
var clr = $(this).val();
$("#bgcolor").css("background-color",clr);
});
});
function showMyImage(fileInput) {
var files = fileInput.files;
for (var i = 0; i < files.length; i++) {
var file = files[i];
var imageType = /image.*/;
if (!file.type.match(imageType)) {
continue;
}
var img=document.getElementById("thumbnil");
img.file = file;
var reader = new FileReader();
reader.onload = (function(aImg) {
return function(e) {
aImg.src = e.target.result;
};
})(img);
reader.readAsDataURL(file);
}
}
</script>
<style type="text/css">
.upload input{
display: none;
}
.upload label{
background: DarkSlateBlue;
color: white;
padding: 2px 10px;
}
#keyConfContainer {
height: 300px;
width: 487px;
border: 1px solid #000;
}
#keyconfTittle {
text-transform: uppercase;
height: 25px;
width: 487px;
}
#keycap {
float: left;
height: 243px;
width: 243px;
border: 1px solid #000;
}
#options {
height: 25px;
width: 242px;
float: right;
}
#menu {
float: right;
height: 250px;
width: 242px;
}
#keycapconf {
float: right;
height: 275px;
width: 242px;
}
</style>
</head>
<body>
<div id="keyConfContainer">
<div id="keyconfTittle">
Modify a keycap
</div>
<div id="keycap">
<div class="upload">
<label for="my-input">Upload your image</label> <input accept=
"image/*" id="my-input" name="" onchange="showMyImage(this)"
type="file">
</div>
<br>
<div id="bgcolor"><img alt="" id="thumbnil" src="" style=
"width:100%; margin-top:10px;">
</div>
</div>
<div id="keycapconf">
<div id="options">
</div>
<div id="menu">
Blackground-color: <input id="color" type="color"><br>
Clip art library:
<!-- implementar la ventana con las imagenes--><br>
Upload your image:
<form action="demo_form.asp">
<input accept="image/*" name="pic" type="file" value=
"Upload a image"> <input type="submit" value="Change">
</form>
</div>
</div>
</div>
</body>
</html>
Here is a link for the jsfidlebut imageuploading doesnt work. http://jsfiddle.net/nmpj3qdp/
Any idea? is there any jquery that could fit my requierement?