adding dynamic image upload preview to the member edit view
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 12 Apr 2019 13:47:22 +0000 (09:47 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 12 Apr 2019 13:47:22 +0000 (09:47 -0400)
views/admin/member/memberInfo/editProfile.html

index 5d449fa..cbbd454 100644 (file)
             listComponent({
                 // activates tooltips OR NOT 
             })
+            function readURL(input) {
+
+                if (input.files && input.files[0]) {
+                    var reader = new FileReader();
+
+                    reader.onload = function(e) {
+                        // $('#blah').attr('src', e.target.result);
+                       {literal} $("#glma-profile-image").css({background: 'url('+ e.target.result +') no-repeat center center / cover'}) {/literal}
+                    }
+
+                    reader.readAsDataURL(input.files[0]);
+                }
+            }
+
+            $("#glm-admin-member-profile-image").change(function() {
+                readURL(this);
+            });
             // $('#glm-table-profile .glma-input-condensed').on("click", function(){
             //     console.log("expanding field");
             //     $(this).addClass("glma-input-expanded").removeClass("glma-input-condensed");
                 input.one('blur', save).focus();
             });
 
-        })
+        });
         </script>
\ No newline at end of file