如何在此代码(angular2-img-cropper)中集成和发送图像裁剪?

时间:2019-03-13 19:48:40

标签: node.js angular cropper

我需要知道如何将弯曲的图像发送到后端,因为它发送的原始图像没有裁剪,并且我无法对其进行集成。

我使用这个库:https://github.com/cstefanache/angular2-img-cropper

我想我必须看看如何获​​取数据变量,但我不知道如何

这是我的HTML代码:

Thermal<-function(S,t=0.000000000001,k=1){
  #Defing beta
  beta<-1/(k*t)
  #multiplying each point of the array by all its adjacent points 
  #and summing them
  Spointenergy<-S*((S2)+(S3)+S4+S5)
  #Creating a loop over the whole array
    for(i in 1:n){
      for (j in 1:n){
        #defining the change in energy at each point
        dE<-energychange(S,i,j)
        #By default each point does not flip
        accept<-FALSE
        #If energy decreases spin flip occurs 100% of the time
        if (dE<0){
          accept<-TRUE
        }
        #If energy increases a spin flip will occur if w is greater than or equal
        #to u.
        if (dE>=0){
          w<-exp(-beta*dE)
          u<-runif(1,0,1)
          if (w>=u){ 
            accept<-TRUE
        }
        }
      #If no spin flip occurs there is no change in energy
      if (accept==FALSE){
        dE<-0
      }
      #if spin flip does occur then the magnitude of each lattice point is flipped
      #from positive to negative or visa versa
      if (accept==TRUE){ 
        S[i,j]<--S[i,j]
      }
      }
  }
  return(S)
}

[![屏幕2] [2]] [2]

这是我的组件。

<div class="card-body">
                <h4 class="card-title">Fotografia del usuario</h4>
                <h6 class="card-subtitle">{{usuario.nombre}}</h6>

                <img-cropper [image]="data" [settings]="cropperSettings" (change)="seleccionImagen($event.target.files[0])"></img-cropper><br>
                <img [src]="data.image" [width]="cropperSettings.croppedWidth" [height]="cropperSettings.croppedHeight">

                <!-- <img class="img-fluid" [src]="usuario.img | imagen" alt="">
                <input class="btn-top" (change)="seleccionImagen($event.target.files[0])" type="file" name="" id=""> -->

                <button type="button" (click)="cambiarImagen()" [disabled]="!imagenSubir" mat-raised-button color="primary" class="btn btn-success btn-top">Actualizar Foto</button>

            </div>

0 个答案:

没有答案