-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
129 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"printWidth": 140, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.formatOnSave": true | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
projects/ngx-image2dataurl/src/lib/image-to-data-url.module.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
<img [src]="src" *ngIf="src"><br> | ||
<input type="file" [imageToDataUrl]="options" | ||
(imageSelected)="selected($event)"> | ||
<img [src]="src" *ngIf="src" /><br /> | ||
<input type="file" [imageToDataUrl]="options" (imageSelected)="selected($event)" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
import { createImageFromDataUrl, getImageTypeFromDataUrl, ImageFileProcessor } from "ngx-image2dataurl"; | ||
import { Injectable } from "@angular/core"; | ||
|
||
import { createImageFromDataUrl, getImageTypeFromDataUrl, ImageFileProcessor } from 'ngx-image2dataurl'; | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable() | ||
export class RotateImageFileProcessor implements ImageFileProcessor { | ||
async process(dataURL: string): Promise<string> { | ||
const canvas = document.createElement('canvas'); | ||
const image = await createImageFromDataUrl(dataURL); | ||
canvas.width = image.height; | ||
canvas.height = image.width; | ||
const ctx = canvas.getContext("2d"); | ||
//ctx.save(); | ||
ctx.translate(canvas.width / 2, canvas.height / 2); | ||
ctx.rotate(Math.PI / 2); | ||
ctx.drawImage(image, -image.width / 2, -image.height / 2); | ||
//ctx.restore(); | ||
return canvas.toDataURL(getImageTypeFromDataUrl(dataURL)); | ||
} | ||
|
||
} | ||
export class RotateImageFileProcessor implements ImageFileProcessor { | ||
async process(dataURL: string): Promise<string> { | ||
const canvas = document.createElement('canvas'); | ||
const image = await createImageFromDataUrl(dataURL); | ||
canvas.width = image.height; | ||
canvas.height = image.width; | ||
const ctx = canvas.getContext('2d'); | ||
//ctx.save(); | ||
ctx.translate(canvas.width / 2, canvas.height / 2); | ||
ctx.rotate(Math.PI / 2); | ||
ctx.drawImage(image, -image.width / 2, -image.height / 2); | ||
//ctx.restore(); | ||
return canvas.toDataURL(getImageTypeFromDataUrl(dataURL)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const environment = { | ||
production: true | ||
production: true, | ||
}; |
Oops, something went wrong.