Hi i have a resizable jquery div ,and an image inside this div .
$( function() {
  var inputLocalFont = document.getElementById("user_file");
  inputLocalFont.addEventListener("change",previewImages,false);
  function previewImages(){
    var fileList = this.files;
    var anyWindow = window.URL || window.webkitURL;
    for(var i = 0; i < fileList.length; i++){
      var objectUrl = anyWindow.createObjectURL(fileList[i]);
      $('.new-multiple').append('<div class="img-div"><img src="' + objectUrl + '" class="newly-added" /></div>');
      window.URL.revokeObjectURL(fileList[i]);
    }
    $( ".img-div" ).draggable();
    $( ".img-div" ).resizable();
    $(".newly-added").on("click", function(e) {
      $(".newly-added").removeClass("img-selected");
      $(this).addClass("img-selected");
      e.stopPropagation();
    });
    $(document).on("click", function(e) {
      if ($(e.target).is(".newly-added") === false) {
        $(".newly-added").removeClass("img-selected");
      }
    });
  } 
});.new-multiple {
  width:400px !important;
  height:400px !important;
  background:white;
  border:2px solid red;
  overflow:hidden;
}
  
.img-div {
  width:200px;
  height:200px;
} 
.newly-added {
  width:100%;
  height:100%;
} 
.img-selected{
  box-shadow: 1px 2px 6px 6px rgb(206, 206, 206);
}<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<input   name="user_file[]" id="user_file" style="position: relative;overflow: hidden" multiple="" type="file">
<div class="new-multiple"></div>https://jsfiddle.net/vd11qyzv/7/
Here i have to set the image width , div width manually for the initial loading
.img-div{
   width:200px;
   height:200px;
 } 
 .newly-added{
    width:100%;
    height:100%;
}  
if i didn't use this css then resizable will not work.
But i don't want to do this . Because the uploaded image will become stretched or enlarged because of this manual width and height . Original image dimension will lost.
How can we solve this ?
 
     
    