0

I am trying to convert the id="send_to_db" image to a canvas form and send to php i have googled alto but for particulate cropped image I dint find any use full code, is there a way to convert the image after it is cropped and displayed on image ,that particulate image to create a blob form and send to php through ajax
FIDDEL:EXAMPLE
JS:

angular.module('app', ['ngImgCrop'])
  .controller('Ctrl', function($scope) {
    $scope.myImage='';
    $scope.myCroppedImage='';

    var handleFileSelect=function(evt) {
      var file=evt.currentTarget.files[0];
      var reader = new FileReader();
      reader.onload = function (evt) {
        $scope.$apply(function($scope){
          $scope.myImage=evt.target.result;
        });
      };
      reader.readAsDataURL(file);
    };
    angular.element(document.querySelector('#fileInput')).on('change',handleFileSelect);
  });

CSS:

.cropArea {
  background: #E4E4E4;
  overflow: hidden;
  width:500px;
  height:350px;
}

HTML:

<link href="https://cdn.rawgit.com/alexk111/ngImgCrop/master/compile/minified/ng-img-crop.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.min.js"></script>



<body ng-app="app" ng-controller="Ctrl">
  <div>Select an image file: <input type="file" id="fileInput" /></div>
  <div class="cropArea">
    <img-crop image="myImage" result-image="myCroppedImage"></img-crop>
  </div>
  <div>Cropped Image:</div>
  <div><img id="send_to_db" ng-src="{{myCroppedImage}}" /></div>
</body>
  • Possibly relevant: http://stackoverflow.com/q/12728188/3512867 and http://stackoverflow.com/q/1590965/3512867 – spenibus Jul 16 '15 at 09:37
  • @spenibus thanx for reply but that posts are not converting the image am new to this can u help me on that ma b am wrong on that?? –  Jul 16 '15 at 09:41
  • If I had an actual answer, I would have written it as such. I'm just trying to push you in the right direction. – spenibus Jul 16 '15 at 09:44
  • @spenibus ok ty.. or else help me where a image can b cropped and converted in to a blob file and send to php via ajax.?? i mean to say to mysql DB from client to server –  Jul 16 '15 at 09:49
  • Please read the answers in the links I posted. I can't help you further than that. – spenibus Jul 16 '15 at 09:51

0 Answers0