Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <script type="text/javascript">
  2.         var $uploadCrop;
  3.  
  4.         function readFile(input) {
  5.             if (input.files && input.files[0]) {
  6.                 var reader = new FileReader();
  7.  
  8.                 reader.onload = function (e) {
  9.                     $('.nextpp').addClass('readyr');
  10.                     if (e.target.result !== undefined) {
  11.                         $uploadCrop.croppie('bind', {
  12.                             url: e.target.result
  13.                         }).then(function () {
  14.                         });
  15.                     }
  16.                 };
  17.  
  18.                 reader.readAsDataURL(input.files[0]);
  19.             }
  20.             else {
  21.                 if (!window.FileReader) {
  22.                     swal("Sorry - you're browser doesn't support the FileReader API");
  23.                 }
  24.             }
  25.         }
  26.  
  27.         $('#profile_picture').on('change', function () {
  28.             $(".currentpp").hide();
  29.             if(!($('.nextpp').hasClass('readyr')))
  30.             {
  31.                 $uploadCrop = $('.nextpp').croppie({
  32.                     enableExif: true,
  33.                     viewport: {
  34.                         width: 350,
  35.                         height: 350
  36.                     },
  37.                     boundary: {
  38.                         width: 400,
  39.                         height: 400
  40.                     }
  41.                 });
  42.             }
  43.             readFile(this);
  44.         });
  45.  
  46.         $('.nextpp').on('update.croppie', function(ev, cropData) {
  47.             $(".preview-section").removeClass('hide');
  48.                 var base64 = $(this).croppie('result',{type: 'base64', circle: 'false' , size: 'original' }).then(function(data){
  49.                     $(".preview").attr("src",data);
  50.                     $(".preview-circle").attr("src",data);
  51.                     $("#pbase64").val(data);
  52.                 });
  53.  
  54.  
  55.         });
  56.  
  57.  
  58.  
  59.  
  60.         $(document).on("click","#change_profile_picture",function(e){
  61.                    $("#details_pp").remove('col-md-3').addClass('col-md-12 expanded');
  62.                    $("#details_personal").remove('col-md-9').addClass('col-md-12');
  63.         });
  64.  
  65.  
  66.  
  67.  
  68.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement