您好我使用ImageResizer上传了图片
使用此代码
var instructions = new ImageResizer.Instructions
{
Width = Convert.ToInt32(Newwidth),
Height = Convert.ToInt32(Newheiht),
Format = "jpg",
Mode = ImageResizer.FitMode.Crop,
Scale = ImageResizer.ScaleMode.Both,
};
File.InputStream.Seek(0, SeekOrigin.Begin);
ImageResizer.ImageJob i = new ImageResizer.ImageJob(File, Filepath, instructions);
i.CreateParentDirectory = false;
i.Build();
我尝试过使用
AutoRotate = true
我仍然将图像旋转到horizontall
我也试过Rotate=90
图片旋转并丢失了比例,这是旋转
调整大小的roteted图片将其更改为width = 296 height = 437而不是height = 296 width = 437
图像是使用三星galaxy 3购买时调整大小并上传它显示在地平线
这是拍摄的原始照片:
以上是上传后的显示方式:
答案 0 :(得分:0)
尝试自动旋转属性“True”;它对我有用。
import { Component, Injectable, OnInit, OnDestroy } from '@angular/core';
import {BehaviorSubject} from "rxjs/BehaviorSubject";
import {Subscription} from 'rxjs/Subscription';
@Injectable()
class ProcessService {
private _processedMsgSrc: BehaviourSubject<string> = new BehaviorSubject<string>("");
processedMsg = this._processedMsgSrc.asObservable();
process(msg) {
this._processedMsgSrc.next("Processed: \""+msg+"\"");
}
}
@Component({
selector: 'output',
template: '<span>{{output}}</span>'
})
class OutputComponent implements OnInit, OnDestroy {
output:string;
private _subscription:Subscription;
constructor(public processService: ProcessService){}
ngOnInit() {
this.subscription = this.processService.processedMsg.subscribe(
msg => this.output = msg
);
}
ngOnDestroy() {
// stop the subscription when the component is destroyed
this.subscription.unsubscribe();
}
}
@Component({
selector: 'my-app',
directives: [OutputComponent],
providers: [ProcessService],
template: `
<input class="input" type ="text" [(ngModel)]="text" (keyup.enter)="process(text)">
<br>
<output></output>
`
})
export class AppComponent {
text:string;
constructor(private processService: ProcessService){}
process(text){
this.processService.process(text);
}
}