Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="container">
  <br/>
  <h1>Croppie.js Overview</h1><br/>
  <div class="row">
    <div class="col-md-6 image_overlay">
      <div class="row">
        <div class="col-md-12">
          <div class="view overlay hm-white-slight">
            <img class="avatar_image img-fluid mx-auto d-block" src="https://raw.githubusercontent.com/cromartie1984/diablo3-project/master/default_avatar_male.jpg" />
            <a>
              <div class="mask waves-effect waves-light"></div>
            </a>
          </div>
        </div>
      </div>
    </div>
    <div class="col-md-6">
     <div class="row">
                                                <div class="col-md-12">
                                                    <a class="btn btn-info file-btn btn-block" type="button">
                                                        <i class="fa fa-folder-open-o"></i> IMPORT
                                                        <input type="file" id="upload" value="Choose a file" accept="image/*">
                                                    </a>
                                                </div>
                                                <div class="col-md-6 pr-0">
                                                    <button type="button" class="btn btn-info rotate_left hidden-xs-up ml-0 w-100" data-deg="-90">
                                                        <i class="fa fa-repeat" aria-hidden="true"></i> Rotate left
                                                    </button>
                                                </div>
                                                <div class="col-md-6">
                                                    <button type="button" class="btn btn-info rotate_right hidden-xs-up w-100 float-right mr-0" data-deg="90">
                                                        <i class="fa fa-repeat" aria-hidden="true"></i> Rotate right
                                                    </button>
                                                </div>
                                                <div class="clearfix"></div>
                                              
                                                <div class="col-md-12 hidden-xs-up text-left" id="common_presets">
                                                    <strong>Common Presets</strong>
                                                    <select type="text"  name="common_presets" class="js-states form-control">
                                                        <option value="16:9" selected>HD Video 16:9</option>
                                                        <option value="4:3"">Standard Monitor 4:3</option>
                                                        <option value="3:2">Classic Film 3:2</option>
                                                        <option value="21:9">Cinemascope 21:9</option>
                                                    </select>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="md-form hidden-xs-up">
                                                        <i class="fa fa-text-width prefix active" aria-hidden="true"></i>
                                                        <input type="number" id="ratio_width" name="ratio_width" class="form-control" value="16" min="1" step="1" max="20">
                                                        <label for="ratio_width" class="active">Ratio width</label>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="md-form hidden-xs-up">
                                                        <i class="fa fa-text-height prefix active" aria-hidden="true"></i>
                                                        <input type="number" id="ratio_height" name="ratio_height" class="form-control" value="9" min="1" step="1" max="20">
                                                        <label for="ratio_height" class="active">Ratio height</label>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="md-form hidden-xs-up">
                                                        <i class="fa fa-text-width prefix active" aria-hidden="true"></i>
                                                        <input type="number" id="pixels_width" name="pixels_width" class="form-control" min="176" step="2" max="2560">
                                                        <label for="pixels_width" class="active">Pixels width</label>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="md-form hidden-xs-up">
                                                        <i class="fa fa-text-height prefix active" aria-hidden="true"></i>
                                                        <input type="number" id="pixels_height" name="pixels_height" class="form-control" min="176" step="2" disabled>
                                                        <label for="pixels_height" class="active">Pixels height</label>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group hidden-xs-up">
                                                        <input type="checkbox" class="filled-in" id="original_image" checked="checked">
                                                        <label for="original_image" class="float-left">Original image</label>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="switch hidden-xs-up" id="crop-type">
                                                        <label>
                                                            <i class="fa fa-square-o"></i>
                                                            <input type="checkbox">
                                                            <span class="lever"></span>
                                                            <i class="fa fa-circle"></i>
                                                        </label>
                                                    </div>
                                                </div>
                                                <div class="col-md-12">
                                                    <button type="button" class="btn btn-primary btn-block hidden-xs-up image_settings mt-1">
                                                        <i class="fa fa-wrench" aria-hidden="true"></i> Apply Changes
                                                    </button>
                                                </div>
                                                <div class="col-md-12">
                                                    <button type="button" class="btn btn-info btn-block view_picture hidden-xs-up mt-1">
                                                        <i class="fa fa-eye" aria-hidden="true"></i> View Cropped Result
                                                    </button><br/><br/>
                                                </div>
                                            </div>
    </div>
  </div>
  <div><h3>For more information : <a href="https://foliotek.github.io/Croppie/" target="_blank">Croppie</a></h3></div>
</div>
            
          
!
            
              $blue: #a3d5d3;
body {
  background-color: $blue;
}

.switch label input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch label .lever,
.switch label .lever:after {
  content: "";
  display: inline-block;
}

.switch label .lever {
  position: relative;
  width: 40px;
  height: 15px;
  background-color: #818181;
  border-radius: 15px;
  transition: background 0.3s ease;
  margin: 0 16px;
  vertical-align: middle;
}

.switch label input[type="checkbox"]:checked + .lever {
  background-color: #dccfe2;
}

.switch label .lever,
.switch label .lever:after {
  content: "";
  display: inline-block;
}

.switch label {
  cursor: pointer;
  font-size: 22px;
  margin-left: 5px;
}

.switch label .lever:after {
  position: absolute;
  width: 21px;
  height: 21px;
  background-color: #f1f1f1;
  border-radius: 21px;
  box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.4);
  left: -5px;
  top: -3px;
  transition: left 0.3s ease, background 0.3s ease, box-shadow 0.1s ease;
}

.switch label input[type="checkbox"]:checked + .lever:after {
  background-color: #a6c;
}

.switch label input[type="checkbox"]:checked + .lever:after {
  left: 24px;
}

.switch label input[type="checkbox"]:checked + .lever {
  background-color: #dccfe2;
}

.checkbox-rounded [type="checkbox"][class*='filled-in']+label:after {
    border-radius: 50%;
}

[type=checkbox]+label, [type=radio]:checked+label, [type=radio]:not(:checked)+label {
    padding-left: 35px;
    display: inline-block;
    line-height: 25px;
    cursor: pointer;
    font-size: 1rem;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -khtml-user-select: none;
}

[type=checkbox]+label {
    position: relative;
    height: 25px;
}

[type=checkbox]+label:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 18px;
    height: 18px;
    z-index: 0;
    border: 2px solid #5a5a5a;
    border-radius: 1px;
    margin-top: 2px;
    -webkit-transition: .2s;
    -moz-transition: .2s;
    -o-transition: .2s;
    -ms-transition: .2s;
    transition: .2s;
}

[type=checkbox].filled-in:not(:checked)+label:before {
    width: 0;
    height: 0;
    border: 3px solid transparent;
    left: 6px;
    top: 10px;
    -webkit-transform: rotateZ(37deg);
    -ms-transform: rotate(37deg);
    transform: rotateZ(37deg);
    -webkit-transform-origin: 20% 40%;
    -ms-transform-origin: 100% 100%;
    transform-origin: 100% 100%;
}

[type=checkbox].filled-in:not(:checked)+label:after {
    height: 20px;
    width: 20px;
    background-color: transparent;
    border: 2px solid #5a5a5a;
    top: 0;
    z-index: 0;
}

[type=checkbox]:checked+label:before {
    top: -4px;
    left: -3px;
    width: 12px;
    height: 22px;
    border-top: 2px solid transparent;
    border-left: 2px solid transparent;
    border-right: 2px solid #4285F4;
    border-bottom: 2px solid #4285F4;
    -webkit-transform: rotate(40deg);
    -moz-transform: rotate(40deg);
    -ms-transform: rotate(40deg);
    -o-transform: rotate(40deg);
    transform: rotate(40deg);
    -webkit-backface-visibility: hidden;
    -webkit-transform-origin: 100% 100%;
    -moz-transform-origin: 100% 100%;
    -ms-transform-origin: 100% 100%;
    -o-transform-origin: 100% 100%;
    transform-origin: 100% 100%;
}

[type=checkbox].filled-in+label:after, [type=checkbox].filled-in+label:before {
    content: '';
    left: 0;
    position: absolute;
    transition: border .25s,background-color .25s,width .2s .1s,height .2s .1s,top .2s .1s,left .2s .1s;
    z-index: 1;
}


[type=checkbox].filled-in:checked+label:before {
    top: 0;
    left: 1px;
    width: 8px;
    height: 13px;
    border-top: 2px solid transparent;
    border-left: 2px solid transparent;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    -webkit-transform: rotateZ(37deg);
    -ms-transform: rotate(37deg);
    transform: rotateZ(37deg);
    -webkit-transform-origin: 100% 100%;
    -ms-transform-origin: 100% 100%;
    transform-origin: 100% 100%;
}

[type=checkbox].filled-in+label:after {
    border-radius: 2px;
}

[type=checkbox].filled-in:checked+label:after {
    top: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #8abb9b;
    background-color: #8abb9b;
    z-index: 0;
}

[type=checkbox]:checked, [type=checkbox]:not(:checked), [type=radio] {
    position: absolute;
    left: -9999px;
    visibility: hidden;
}

.form-inline .form-group{
    position: relative;
}

.view:not(.hm-zoom) {
  overflow: visible;
}

.view img,
.view video {
  display: block;
  position: relative;
}

.image_overlay .croppie-container {
    height: 475px;
}

.avatar_image {
  margin-bottom: 5px;
}

button,
html [type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: none;
}

.file-btn {
  position: relative;
}

.image_overlay .view.overlay {
  margin-bottom: 50px;
}

.image_overlay .avatar_image {
  box-shadow: 0 5px 11px 0 rgba(0, 0, 0, 0.18), 0 4px 15px 0 rgba(0, 0, 0, 0.15);
}

input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

input[type="range"] {
  -webkit-appearance: none;
}

/*Range slider*/

input[type="range"] {
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: none;
  cursor: pointer;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  height: 100%;
  min-height: 50px;
  overflow: hidden;
  width: 240px;
  position: relative;
  margin-right: auto !important;
  margin-left: auto !important;
}
input[type="range"]:focus {
  box-shadow: none;
  outline: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  background: #9c27b0;
  content: "";
  height: 2px;
  pointer-events: none;
}
input[type="range"]::-webkit-slider-thumb {
  height: 18px;
  width: 28px;
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  border-radius: 8px;
  box-shadow: 5px 0 0 -8px #c7c7c7, 6px 0 0 -8px #c7c7c7, 7px 0 0 -8px #c7c7c7,
    8px 0 0 -8px #c7c7c7, 9px 0 0 -8px #c7c7c7, 10px 0 0 -8px #c7c7c7,
    11px 0 0 -8px #c7c7c7, 12px 0 0 -8px #c7c7c7, 13px 0 0 -8px #c7c7c7,
    14px 0 0 -8px #c7c7c7, 15px 0 0 -8px #c7c7c7, 16px 0 0 -8px #c7c7c7,
    17px 0 0 -8px #c7c7c7, 18px 0 0 -8px #c7c7c7, 19px 0 0 -8px #c7c7c7,
    20px 0 0 -8px #c7c7c7, 21px 0 0 -8px #c7c7c7, 22px 0 0 -8px #c7c7c7,
    23px 0 0 -8px #c7c7c7, 24px 0 0 -8px #c7c7c7, 25px 0 0 -8px #c7c7c7,
    26px 0 0 -8px #c7c7c7, 27px 0 0 -8px #c7c7c7, 28px 0 0 -8px #c7c7c7,
    29px 0 0 -8px #c7c7c7, 30px 0 0 -8px #c7c7c7, 31px 0 0 -8px #c7c7c7,
    32px 0 0 -8px #c7c7c7, 33px 0 0 -8px #c7c7c7, 34px 0 0 -8px #c7c7c7,
    35px 0 0 -8px #c7c7c7, 36px 0 0 -8px #c7c7c7, 37px 0 0 -8px #c7c7c7,
    38px 0 0 -8px #c7c7c7, 39px 0 0 -8px #c7c7c7, 40px 0 0 -8px #c7c7c7,
    41px 0 0 -8px #c7c7c7, 42px 0 0 -8px #c7c7c7, 43px 0 0 -8px #c7c7c7,
    44px 0 0 -8px #c7c7c7, 45px 0 0 -8px #c7c7c7, 46px 0 0 -8px #c7c7c7,
    47px 0 0 -8px #c7c7c7, 48px 0 0 -8px #c7c7c7, 49px 0 0 -8px #c7c7c7,
    50px 0 0 -8px #c7c7c7, 51px 0 0 -8px #c7c7c7, 52px 0 0 -8px #c7c7c7,
    53px 0 0 -8px #c7c7c7, 54px 0 0 -8px #c7c7c7, 55px 0 0 -8px #c7c7c7,
    56px 0 0 -8px #c7c7c7, 57px 0 0 -8px #c7c7c7, 58px 0 0 -8px #c7c7c7,
    59px 0 0 -8px #c7c7c7, 60px 0 0 -8px #c7c7c7, 61px 0 0 -8px #c7c7c7,
    62px 0 0 -8px #c7c7c7, 63px 0 0 -8px #c7c7c7, 64px 0 0 -8px #c7c7c7,
    65px 0 0 -8px #c7c7c7, 66px 0 0 -8px #c7c7c7, 67px 0 0 -8px #c7c7c7,
    68px 0 0 -8px #c7c7c7, 69px 0 0 -8px #c7c7c7, 70px 0 0 -8px #c7c7c7,
    71px 0 0 -8px #c7c7c7, 72px 0 0 -8px #c7c7c7, 73px 0 0 -8px #c7c7c7,
    74px 0 0 -8px #c7c7c7, 75px 0 0 -8px #c7c7c7, 76px 0 0 -8px #c7c7c7,
    77px 0 0 -8px #c7c7c7, 78px 0 0 -8px #c7c7c7, 79px 0 0 -8px #c7c7c7,
    80px 0 0 -8px #c7c7c7, 81px 0 0 -8px #c7c7c7, 82px 0 0 -8px #c7c7c7,
    83px 0 0 -8px #c7c7c7, 84px 0 0 -8px #c7c7c7, 85px 0 0 -8px #c7c7c7,
    86px 0 0 -8px #c7c7c7, 87px 0 0 -8px #c7c7c7, 88px 0 0 -8px #c7c7c7,
    89px 0 0 -8px #c7c7c7, 90px 0 0 -8px #c7c7c7, 91px 0 0 -8px #c7c7c7,
    92px 0 0 -8px #c7c7c7, 93px 0 0 -8px #c7c7c7, 94px 0 0 -8px #c7c7c7,
    95px 0 0 -8px #c7c7c7, 96px 0 0 -8px #c7c7c7, 97px 0 0 -8px #c7c7c7,
    98px 0 0 -8px #c7c7c7, 99px 0 0 -8px #c7c7c7, 100px 0 0 -8px #c7c7c7,
    101px 0 0 -8px #c7c7c7, 102px 0 0 -8px #c7c7c7, 103px 0 0 -8px #c7c7c7,
    104px 0 0 -8px #c7c7c7, 105px 0 0 -8px #c7c7c7, 106px 0 0 -8px #c7c7c7,
    107px 0 0 -8px #c7c7c7, 108px 0 0 -8px #c7c7c7, 109px 0 0 -8px #c7c7c7,
    110px 0 0 -8px #c7c7c7, 111px 0 0 -8px #c7c7c7, 112px 0 0 -8px #c7c7c7,
    113px 0 0 -8px #c7c7c7, 114px 0 0 -8px #c7c7c7, 115px 0 0 -8px #c7c7c7,
    116px 0 0 -8px #c7c7c7, 117px 0 0 -8px #c7c7c7, 118px 0 0 -8px #c7c7c7,
    119px 0 0 -8px #c7c7c7, 120px 0 0 -8px #c7c7c7, 121px 0 0 -8px #c7c7c7,
    122px 0 0 -8px #c7c7c7, 123px 0 0 -8px #c7c7c7, 124px 0 0 -8px #c7c7c7,
    125px 0 0 -8px #c7c7c7, 126px 0 0 -8px #c7c7c7, 127px 0 0 -8px #c7c7c7,
    128px 0 0 -8px #c7c7c7, 129px 0 0 -8px #c7c7c7, 130px 0 0 -8px #c7c7c7,
    131px 0 0 -8px #c7c7c7, 132px 0 0 -8px #c7c7c7, 133px 0 0 -8px #c7c7c7,
    134px 0 0 -8px #c7c7c7, 135px 0 0 -8px #c7c7c7, 136px 0 0 -8px #c7c7c7,
    137px 0 0 -8px #c7c7c7, 138px 0 0 -8px #c7c7c7, 139px 0 0 -8px #c7c7c7,
    140px 0 0 -8px #c7c7c7, 141px 0 0 -8px #c7c7c7, 142px 0 0 -8px #c7c7c7,
    143px 0 0 -8px #c7c7c7, 144px 0 0 -8px #c7c7c7, 145px 0 0 -8px #c7c7c7,
    146px 0 0 -8px #c7c7c7, 147px 0 0 -8px #c7c7c7, 148px 0 0 -8px #c7c7c7,
    149px 0 0 -8px #c7c7c7, 150px 0 0 -8px #c7c7c7, 151px 0 0 -8px #c7c7c7,
    152px 0 0 -8px #c7c7c7, 153px 0 0 -8px #c7c7c7, 154px 0 0 -8px #c7c7c7,
    155px 0 0 -8px #c7c7c7, 156px 0 0 -8px #c7c7c7, 157px 0 0 -8px #c7c7c7,
    158px 0 0 -8px #c7c7c7, 159px 0 0 -8px #c7c7c7, 160px 0 0 -8px #c7c7c7,
    161px 0 0 -8px #c7c7c7, 162px 0 0 -8px #c7c7c7, 163px 0 0 -8px #c7c7c7,
    164px 0 0 -8px #c7c7c7, 165px 0 0 -8px #c7c7c7, 166px 0 0 -8px #c7c7c7,
    167px 0 0 -8px #c7c7c7, 168px 0 0 -8px #c7c7c7, 169px 0 0 -8px #c7c7c7,
    170px 0 0 -8px #c7c7c7, 171px 0 0 -8px #c7c7c7, 172px 0 0 -8px #c7c7c7,
    173px 0 0 -8px #c7c7c7, 174px 0 0 -8px #c7c7c7, 175px 0 0 -8px #c7c7c7,
    176px 0 0 -8px #c7c7c7, 177px 0 0 -8px #c7c7c7, 178px 0 0 -8px #c7c7c7,
    179px 0 0 -8px #c7c7c7, 180px 0 0 -8px #c7c7c7, 181px 0 0 -8px #c7c7c7,
    182px 0 0 -8px #c7c7c7, 183px 0 0 -8px #c7c7c7, 184px 0 0 -8px #c7c7c7,
    185px 0 0 -8px #c7c7c7, 186px 0 0 -8px #c7c7c7, 187px 0 0 -8px #c7c7c7,
    188px 0 0 -8px #c7c7c7, 189px 0 0 -8px #c7c7c7, 190px 0 0 -8px #c7c7c7,
    191px 0 0 -8px #c7c7c7, 192px 0 0 -8px #c7c7c7, 193px 0 0 -8px #c7c7c7,
    194px 0 0 -8px #c7c7c7, 195px 0 0 -8px #c7c7c7, 196px 0 0 -8px #c7c7c7,
    197px 0 0 -8px #c7c7c7, 198px 0 0 -8px #c7c7c7, 199px 0 0 -8px #c7c7c7,
    200px 0 0 -8px #c7c7c7, 201px 0 0 -8px #c7c7c7, 202px 0 0 -8px #c7c7c7,
    203px 0 0 -8px #c7c7c7, 204px 0 0 -8px #c7c7c7, 205px 0 0 -8px #c7c7c7,
    206px 0 0 -8px #c7c7c7, 207px 0 0 -8px #c7c7c7, 208px 0 0 -8px #c7c7c7,
    209px 0 0 -8px #c7c7c7, 210px 0 0 -8px #c7c7c7, 211px 0 0 -8px #c7c7c7,
    212px 0 0 -8px #c7c7c7, 213px 0 0 -8px #c7c7c7, 214px 0 0 -8px #c7c7c7,
    215px 0 0 -8px #c7c7c7, 216px 0 0 -8px #c7c7c7, 217px 0 0 -8px #c7c7c7,
    218px 0 0 -8px #c7c7c7, 219px 0 0 -8px #c7c7c7, 220px 0 0 -8px #c7c7c7,
    221px 0 0 -8px #c7c7c7, 222px 0 0 -8px #c7c7c7, 223px 0 0 -8px #c7c7c7,
    224px 0 0 -8px #c7c7c7, 225px 0 0 -8px #c7c7c7, 226px 0 0 -8px #c7c7c7,
    227px 0 0 -8px #c7c7c7, 228px 0 0 -8px #c7c7c7, 229px 0 0 -8px #c7c7c7,
    230px 0 0 -8px #c7c7c7, 231px 0 0 -8px #c7c7c7, 232px 0 0 -8px #c7c7c7,
    233px 0 0 -8px #c7c7c7, 234px 0 0 -8px #c7c7c7, 235px 0 0 -8px #c7c7c7,
    236px 0 0 -8px #c7c7c7, 237px 0 0 -8px #c7c7c7, 238px 0 0 -8px #c7c7c7,
    239px 0 0 -8px #c7c7c7, 240px 0 0 -8px #c7c7c7;
  margin-top: -8px;
  border: 1px solid #9c27b0;
}
input[type="range"]::-moz-range-track {
  width: 240px;
  height: 2px;
}
input[type="range"]::-moz-range-thumb {
  height: 18px;
  width: 28px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #777;
  position: relative;
}
input[type="range"]::-moz-range-progress {
  height: 2px;
  background: #9c27b0;
  border: 0;
  margin-top: 0;
}
input[type="range"]::-ms-track {
  background: transparent;
  border: 0;
  border-color: transparent;
  border-radius: 0;
  border-width: 0;
  color: transparent;
  height: 2px;
  margin-top: 10px;
  width: 240px;
}
input[type="range"]::-ms-thumb {
  height: 18px;
  width: 28px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #777;
}
input[type="range"]::-ms-fill-lower {
  background: #9c27b0;
  border-radius: 0;
}
input[type="range"]::-ms-fill-upper {
  background: #c7c7c7;
  border-radius: 0;
}
input[type="range"]::-ms-tooltip {
  display: none;
}

            
          
!
            
              'use strict';
/*
fraction.js
A Javascript fraction library.
Copyright (c) 2009  Erik Garrison <erik@hypervolu.me>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/


/* Fractions */
/* 
 *
 * Fraction objects are comprised of a numerator and a denomenator.  These
 * values can be accessed at fraction.numerator and fraction.denomenator.
 *
 * Fractions are always returned and stored in lowest-form normalized format.
 * This is accomplished via Fraction.normalize.
 *
 * The following mathematical operations on fractions are supported:
 *
 * Fraction.equals
 * Fraction.add
 * Fraction.subtract
 * Fraction.multiply
 * Fraction.divide
 *
 * These operations accept both numbers and fraction objects.  (Best results
 * are guaranteed when the input is a fraction object.)  They all return a new
 * Fraction object.
 *
 * Usage:
 *
 * TODO
 *
 */

/*
 * The Fraction constructor takes one of:
 *   an explicit numerator (integer) and denominator (integer),
 *   a string representation of the fraction (string),
 *   or a floating-point number (float)
 *
 * These initialization methods are provided for convenience.  Because of
 * rounding issues the best results will be given when the fraction is
 * constructed from an explicit integer numerator and denomenator, and not a
 * decimal number.
 *
 *
 * e.g. new Fraction(1, 2) --> 1/2
 *      new Fraction('1/2') --> 1/2
 *      new Fraction('2 3/4') --> 11/4  (prints as 2 3/4)
 *
 */
var Fraction = function(numerator, denominator)
{
    /* double argument invocation */
    if (typeof numerator !== 'undefined' && denominator) {
        if (
			(typeof(  numerator) === 'number' ||   numerator instanceof Number)
		&&
			(typeof(denominator) === 'number' || denominator instanceof Number)
		){
            this.numerator = numerator;
            this.denominator = denominator;
        } else if (
			(typeof(  numerator) === 'string' ||   numerator instanceof String)
		&&
			(typeof(denominator) === 'string' || denominator instanceof String)
		) {
            // what are they?
            // hmm....
            // assume they are floats?
            this.numerator = parseFloat(numerator.replace(",","."));
            this.denominator = parseFloat(denominator.replace(",","."));
        }
        // TODO: should we handle cases when one argument is String and another is Number?
    /* single-argument invocation */
    } else if (typeof denominator === 'undefined') {
        var num = numerator; // swap variable names for legibility
		if (num instanceof Fraction) {
			this.numerator = num.numerator;
			this.denominator = num.denominator;
		} else if (typeof(num) === 'number' || num instanceof Number) {  // just a straight number init
            this.numerator = num;
            this.denominator = 1;
        } else if (typeof(num) === 'string' || num instanceof String) {
            var a, b;  // hold the first and second part of the fraction, e.g. a = '1' and b = '2/3' in 1 2/3
                       // or a = '2/3' and b = undefined if we are just passed a single-part number
            var arr = num.split(' ');
            if (arr[0]) a = arr[0];
            if (arr[1]) b = arr[1];
            /* compound fraction e.g. 'A B/C' */
            //  if a is an integer ...
            if (a % 1 === 0 && b && b.match('/')) {
                return (new Fraction(a)).add(new Fraction(b));
            } else if (a && !b) {
                /* simple fraction e.g. 'A/B' */
                if ((typeof(a) === 'string' || a instanceof String) && a.match('/')) {
                    // it's not a whole number... it's actually a fraction without a whole part written
                    var f = a.split('/');
                    this.numerator = f[0]; this.denominator = f[1];
                /* string floating point */
                } else if ((typeof(a) === 'string' || a instanceof String) && a.match('\.')) {
                    return new Fraction(parseFloat(a.replace(",",".")));
                /* whole number e.g. 'A' */
                } else { // just passed a whole number as a string
                    this.numerator = parseInt(a);
                    this.denominator = 1;
                }
            } else {
                return undefined; // could not parse
            }
        }
    }
    this.normalize();
}


Fraction.prototype.clone = function()
{
    return new Fraction(this.numerator, this.denominator);
}

/* pretty-printer, converts fractions into whole numbers and fractions */
Fraction.prototype.toString = function()
{
	if (isNaN(this.denominator))
//	if (this.denominator !== this.denominator) //They say it would be faster. (?)
		return 'NaN';
    var result = '';
    if ((this.numerator < 0) != (this.denominator < 0))
        result = '-';
    var numerator = Math.abs(this.numerator);
    var denominator = Math.abs(this.denominator);

    var wholepart = Math.floor(numerator / denominator);
    numerator = numerator % denominator;
    if (wholepart != 0)
        result += wholepart;
    if (numerator != 0)
    {
		if(wholepart != 0)
			result+=' ';
        result += numerator + '/' + denominator;
	}
    return result.length > 0 ? result : '0';
}

/* pretty-printer to support TeX notation (using with MathJax, KaTeX, etc) */
Fraction.prototype.toTeX = function(mixed)
{
	if (isNaN(this.denominator))
		return 'NaN';
    var result = '';
    if ((this.numerator < 0) != (this.denominator < 0))
        result = '-';
    var numerator = Math.abs(this.numerator);
    var denominator = Math.abs(this.denominator);

    if(!mixed){
		//We want a simple fraction, without wholepart extracted
		if(denominator === 1)
			return result + numerator;
		else
			return result + '\\frac{' + numerator + '}{' + denominator + '}';
	}
    var wholepart = Math.floor(numerator / denominator);
    numerator = numerator % denominator;
    if (wholepart != 0)
        result += wholepart;
    if (numerator != 0)
        result += '\\frac{' + numerator + '}{' + denominator + '}';
    return result.length > 0 ? result : '0';
}

/* destructively rescale the fraction by some integral factor */
Fraction.prototype.rescale = function(factor)
{
    this.numerator *= factor;
    this.denominator *= factor;
    return this;
}

Fraction.prototype.add = function(b)
{
    var a = this.clone();
    if (b instanceof Fraction) {
        b = b.clone();
    } else {
        b = new Fraction(b);
    }
    var td = a.denominator;
    a.rescale(b.denominator);
    a.numerator += b.numerator * td;

    return a.normalize();
}


Fraction.prototype.subtract = function(b)
{
    var a = this.clone();
    if (b instanceof Fraction) {
        b = b.clone();  // we scale our argument destructively, so clone
    } else {
        b = new Fraction(b);
    }
    var td = a.denominator;
    a.rescale(b.denominator);
    a.numerator -= b.numerator * td;

    return a.normalize();
}


Fraction.prototype.multiply = function(b)
{
    var a = this.clone();
    if (b instanceof Fraction)
    {
        a.numerator *= b.numerator;
        a.denominator *= b.denominator;
    } else if (typeof b === 'number') {
        a.numerator *= b;
    } else {
        return a.multiply(new Fraction(b));
    }
    return a.normalize();
}

Fraction.prototype.divide = function(b)
{
    var a = this.clone();
    if (b instanceof Fraction)
    {
        a.numerator *= b.denominator;
        a.denominator *= b.numerator;
    } else if (typeof b === 'number') {
        a.denominator *= b;
    } else {
        return a.divide(new Fraction(b));
    }
    return a.normalize();
}

Fraction.prototype.equals = function(b)
{
    if (!(b instanceof Fraction)) {
        b = new Fraction(b);
    }
    // fractions that are equal should have equal normalized forms
    var a = this.clone().normalize();
    var b = b.clone().normalize();
    return (a.numerator === b.numerator && a.denominator === b.denominator);
}


/* Utility functions */

/* Destructively normalize the fraction to its smallest representation. 
 * e.g. 4/16 -> 1/4, 14/28 -> 1/2, etc.
 * This is called after all math ops.
 */
Fraction.prototype.normalize = (function()
{

    var isFloat = function(n)
    {
        return (typeof(n) === 'number' &&
                ((n > 0 && n % 1 > 0 && n % 1 < 1) || 
                 (n < 0 && n % -1 < 0 && n % -1 > -1))
               );
    }

    var roundToPlaces = function(n, places) 
    {
        if (!places) {
            return Math.round(n);
        } else {
            var scalar = Math.pow(10, places);
            return Math.round(n*scalar)/scalar;
        }
    }
        
    return (function() {

        // XXX hackish.  Is there a better way to address this issue?
        //
        /* first check if we have decimals, and if we do eliminate them
         * multiply by the 10 ^ number of decimal places in the number
         * round the number to nine decimal places
         * to avoid js floating point funnies
         */
        if (isFloat(this.denominator)) {
            var rounded = roundToPlaces(this.denominator, 9);
            var scaleup = Math.pow(10, rounded.toString().split('.')[1].length);
            this.denominator = Math.round(this.denominator * scaleup); // this !!! should be a whole number
            //this.numerator *= scaleup;
            this.numerator *= scaleup;
        } 
        if (isFloat(this.numerator)) {
            var rounded = roundToPlaces(this.numerator, 9);
            var scaleup = Math.pow(10, rounded.toString().split('.')[1].length);
            this.numerator = Math.round(this.numerator * scaleup); // this !!! should be a whole number
            //this.numerator *= scaleup;
            this.denominator *= scaleup;
        }
        var gcf = Fraction.gcf(this.numerator, this.denominator);
        this.numerator /= gcf;
        this.denominator /= gcf;
        if (this.denominator < 0) {
            this.numerator *= -1;
            this.denominator *= -1;
        }
        return this;
    });

})();


/* Takes two numbers and returns their greatest common factor. */
//Adapted from Ratio.js
Fraction.gcf = function(a, b) {
    if (arguments.length < 2) {
        return a;
    }
    var c;
    a = Math.abs(a);
    b = Math.abs(b);
/*  //It seems to be no need in these checks
    // Same as isNaN() but faster
    if (a !== a || b !== b) {
        return NaN;
    }
    //Same as !isFinite() but faster
    if (a === Infinity || a === -Infinity || b === Infinity || b === -Infinity) {
        return Infinity;
     }
     // Checks if a or b are decimals
     if ((a % 1 !== 0) || (b % 1 !== 0)) {
         throw new Error("Can only operate on integers");
     }
*/

    while (b) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
};

//Not needed now
// Adapted from: 
// http://www.btinternet.com/~se16/js/factor.htm
Fraction.primeFactors = function(n) 
{

    var num = Math.abs(n);
    var factors = [];
    var _factor = 2;  // first potential prime factor

    while (_factor * _factor <= num)  // should we keep looking for factors?
    {      
      if (num % _factor === 0)  // this is a factor
        { 
            factors.push(_factor);  // so keep it
            num = num/_factor;  // and divide our search point by it
        }
        else
        {
            _factor++;  // and increment
        }
    }

    if (num != 1)                    // If there is anything left at the end...
    {                                // ...this must be the last prime factor
        factors.push(num);           //    so it too should be recorded
    }

    return factors;                  // Return the prime factors
}


Fraction.prototype.snap = function(max, threshold) {
    if (!threshold) threshold = .0001;
    if (!max) max = 100;

    var negative = (this.numerator < 0);
    var decimal = this.numerator / this.denominator;
    var fraction = Math.abs(decimal % 1);
    var remainder = negative ? Math.ceil(decimal) : Math.floor(decimal);

    for(var denominator = 1; denominator <= max; ++denominator) {
        for(var numerator = 0; numerator <= max; ++numerator) {
            var approximation = Math.abs(numerator/denominator);
            if (Math.abs(approximation - fraction) < threshold) {
                return new Fraction(remainder * denominator + numerator * (negative ? -1 : 1), denominator);
            }
        }
    }

    return new Fraction(this.numerator, this.denominator);
};

/* If not in browser */
if(typeof module !== "undefined")
    module.exports.Fraction = Fraction

var imageCrop = '';

function popupResult(result) {
		var html;
			html = '<img src="' + result.src + '" />';
		swal({
			title: 'Image Result',
			html: html,
			text: null,
			allowOutsideClick: true
		});
		setTimeout(function(){
			$('.sweet-alert').css('margin', function() {
				var top = -1 * ($(this).height() / 2),
					left = -1 * ($(this).width() / 2);

				return top + 'px 0 0 ' + left + 'px';
			});
		}, 1);
	}

function reset_image(imageCrop) {
    imageCrop ? imageCrop.croppie('destroy') : '';
    
    $('.avatar_image').removeClass("cr-original-image").addClass("img-fluid mx-auto d-block");
    $(".image_overlay .view.overlay").prepend($(".image_overlay .view.overlay > div").html());
    $(".image_overlay .view.overlay > div").remove();
}

function initCropImage(width, height,type, enable_resize) {
    var imageCrop = $('.avatar_image').croppie({
        enableExif: true,
        enableOrientation: true,
        enableZoom: true,
        enforceBoundary: true,
        mouseWheelZoom: true,
        showZoomer: true,
	enableResize: enable_resize,
        /*customClass: "wowy",*/
        viewport: {
            width: width,
            height: height,
            type: type/*circle*/
        }/*,
         boundary: {
         width: "100%",
         height: "100%"
         }*/
    });
    return(imageCrop);
}

var new_image = '', crop_type = 'square', original_image = '', ratio_width = '320', ratio_height='180',
                                pixels_w = '', pixels_h = '', ratio_aspect = '';

$('#upload').on('change', function () {
                                    var selected_file_name = $(this).val();
                                    if (selected_file_name.length > 0) {
                                        /* Some file selected */
                                        var reader = new FileReader();
                                        reader.onload = function (e) {

                                            var image = new Image();
                                            image.src = reader.result;

                                            image.onload = function() {

                                                    pixels_w = image.width;
                                                    pixels_h = image.height;

                                                    $("input[name=pixels_width]").val(pixels_w);
                                              
                                         
                                                    $("input[name=pixels_height]").val(pixels_h);
                                                    ratio_aspect = new Fraction(Math.round(pixels_w / pixels_h * 100)  / 100);
                                              
                                               console.log(Math.round(pixels_w / pixels_h * 100)  / 100)  ;
                                                    $('input[name="ratio_width"]').val(ratio_aspect.numerator);
                                                    $('input[name="ratio_height"]').val(ratio_aspect.denominator);
                                                
                                            }

                                            if (!$(".image_overlay .cr-boundary").length) {
                                                imageCrop = initCropImage(ratio_width, ratio_height, crop_type, false);
                                                $('.avatar_image').removeClass("img-fluid mx-auto d-block");
                                                $(".rotate_left, .rotate_right, .view_picture, .image_settings,  .md-form, .form-group,  .switch, #common_presets").removeClass("hidden-xs-up");
                                            };
                                            new_image = e.target.result;

                                            imageCrop.croppie('bind', {
                                                url: e.target.result
                                            });

                                        };
                                        reader.readAsDataURL(this.files[0]);

                                    }
                                    $(this).val('');
                                });
$('.rotate_left, .rotate_right').on('click', function (ev) {
                                    imageCrop.croppie('rotate', parseInt($(this).data('deg')));
                                });

       $("input[type=number]").on("keyup keydown", function(e){

                                    var max = parseInt($(this).attr('max'));
                                    var min = parseInt($(this).attr('min'));
                                    if ($(this).val() > max && e.keyCode != 46 && e.keyCode != 8) {
                                        e.preventDefault();     
                                        $(this).val(max);
                                    }
                        });

var ratio_w = '', ratio_h = '', ratios = '';
                                $('select[name="common_presets"]').on("change",function(){
                                    ratios = $('select[name="common_presets"]').val().split(":");
                                    $('input[name="ratio_width"]').val(ratios[0]);
                                    $('input[name="ratio_height"]').val(ratios[1]);
                                    $('input[name="pixels_height"]').val(Math.round($('input[name="pixels_width"]').val() * ratios[1] / ratios[0] ));
                                });

                                
                                $('input[name="pixels_width"]').on("input",function(){
                                    ratio_w = $('input[name="ratio_width"]').val();
                                    ratio_h = $('input[name="ratio_height"]').val();
                                    $('input[name="pixels_height"]').val(Math.round($('input[name="pixels_width"]').val() * ratio_h / ratio_w ));
                                });

                                $('input[name="ratio_width"]').on("input",function(){
                                    ratio_h = $('input[name="ratio_height"]').val();
                                    $('input[name="pixels_height"]').val(Math.round($('input[name="pixels_width"]').val() * ratio_h / $(this).val() ));
                                });

                                $('input[name="ratio_height"]').on("input",function(){
                                    ratio_w = $('input[name="ratio_width"]').val();
                                    $('input[name="pixels_height"]').val(Math.round($('input[name="pixels_width"]').val() * $(this).val() / ratio_w ));
                                });

                                $(".image_settings").click(function(){

                                    /*Read aspect ratio settings*/
                                    ratio_width = $('input[name="ratio_width"]').val() * 10;
                                    ratio_height = $('input[name="ratio_height"]').val() * 10;

                                    /*Read type of crop*/
                                    if ($("#crop-type input[type=checkbox]").is(":checked")){
                                        crop_type = 'circle';
                                    }
                                    else
                                    {
                                        crop_type = 'square';
                                    }

                                    if ($('#original_image').is(":checked")){
                                        reset_image(imageCrop);
                                        imageCrop = initCropImage(ratio_width, ratio_height, crop_type,  false);
                                        $(".avatar_image").removeClass("img-fluid mx-auto d-block");
                                        imageCrop.croppie('bind', {
                                            url: new_image
                                        });
                                    }
                                    else
                                    {
                                        imageCrop.croppie('result', {
                                            type: 'canvas',
                                            size: 'viewport'
                                        }).then(function (resp) {

                                            $(".avatar_image").attr({"src": resp});
                                            reset_image(imageCrop);
                                            imageCrop = initCropImage(ratio_width, ratio_height, crop_type,  false);
                                            $('.avatar_image').removeClass("img-fluid mx-auto d-block");
                                        });
                                    }

                                });

$(".view_picture").click(function(){
  imageCrop.croppie('result', {
				type: 'canvas',
				size: 'viewport'
			}).then(function (resp) {
				popupResult({
					src: resp
				});
			});
});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console