1#imageUpload
2{
3 display: none;
4}
5
6#profileImage
7{
8 cursor: pointer;
9}
10
11#profile-container {
12 width: 150px;
13 height: 150px;
14 overflow: hidden;
15 -webkit-border-radius: 50%;
16 -moz-border-radius: 50%;
17 -ms-border-radius: 50%;
18 -o-border-radius: 50%;
19 border-radius: 50%;
20}
21
22#profile-container img {
23 width: 150px;
24 height: 150px;
25}
1<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
2<div id="profile-container">
3 <image id="profileImage" src="http://lorempixel.com/100/100" />
4</div>
5<input id="imageUpload" type="file"
6 name="profile_photo" placeholder="Photo" required="" capture>
1$("#profileImage").click(function(e) {
2 $("#imageUpload").click();
3});
4
5function fasterPreview( uploader ) {
6 if ( uploader.files && uploader.files[0] ){
7 $('#profileImage').attr('src',
8 window.URL.createObjectURL(uploader.files[0]) );
9 }
10}
11
12$("#imageUpload").change(function(){
13 fasterPreview( this );
14});