Bootstrap 3 Template
This is a simple Twitter Bootstrap 3 template. You can fork it to get a ready to use Bootstrap 3 fiddle.
HTML
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<div class="row">
<div class="small-12 medium-2 large-2 columns">
<div class="circle">
<!-- User Profile Image -->
<img
class="profile-pic"
src=""
style="height:128pxpx; width:128px"
>
</div>
<div class="p-image">
<!-- <i class="fa fa-camera upload-button"></i> -->
<input class="file-upload" type="file" accept="image/*">
</div>
</div>
</div>
CSS
/* Latest compiled and minified CSS included as External Resource*/
/* Optional theme */
@import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css');
body {
margin: 10px;
background-color: #efefef;
}
.profile-pic {
max-width: 200px;
max-height: 200px;
display: block;
}
.file-upload {
display: none;
}
.circle {
border-radius: 1000px !important;
overflow: hidden;
width: 128px;
height: 128px;
border: 8px solid rgba(255, 255, 255, 0.7);
position: absolute;
top: 72px;
}
img {
max-width: 100%;
height: auto;
}
.p-image {
position: absolute;
top: 167px;
right: 30px;
color: #666666;
transition: all .3s cubic-bezier(.175, .885, .32, 1.275);
}
.p-image:hover {
transition: all .3s cubic-bezier(.175, .885, .32, 1.275);
}
.upload-button {
font-size: 1.2em;
}
.upload-button:hover {
transition: all .3s cubic-bezier(.175, .885, .32, 1.275);
color: #999;
}
JavaScript
/* Latest compiled and minified JavaScript included as External Resource */
$(document).ready(function() {
var readURL = function(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('.profile-pic').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$(".file-upload").on('change', function(){
readURL(this);
});
$(".upload-button").on('click', function() {
$(".file-upload").click();
});
});