沈斌
2017-12-15 f9b157566af34b8dc28ba10b34d025ac04f3168b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<div class="content__title">
    <h1>Image Cropper</h1>
</div>
<div nz-row [nzGutter]="16">
    <div nz-col [nzMd]="6">
        <nz-card>
            <h3 class="text-md">Select an image file</h3>
            <button nz-button class="ant-btn__block file-upload mt-sm">
                <input id="file1" accept type="file" (change)="fileChange($event)" />
                <i class="anticon anticon-upload"></i><span>Upload a image</span>
            </button>
            <h3 class="text-md my-md">Crop type</h3>
            <nz-radio-group [(ngModel)]="cropperSettings.rounded">
                <label nz-radio-button [nzValue]="false"><span>Square</span></label>
                <label nz-radio-button [nzValue]="true"><span>Circle</span></label>
            </nz-radio-group>
            <div class="my-md" *ngIf="data1.image">
                <h3 class="text-md">Cropped image</h3>
                <img [class.rounded-circle]="cropperSettings.rounded"
                    [src]="data1.image"
                    [width]="cropperSettings.croppedWidth"
                    [height]="cropperSettings.croppedHeight">
            </div>
        </nz-card>
    </div>
    <div nz-col [nzMd]="18">
        <div nz-row>
            <div nz-col [nzSpan]="24">
                <nz-card>
                    <img-cropper #cropper [image]="data1" [settings]="cropperSettings" (onCrop)="cropped($event)"></img-cropper>
                </nz-card>
            </div>
        </div>
    </div>
</div>