@guajiritos/image-picker 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -40
- package/esm2022/lib/guachos-image-picker.component.mjs +517 -0
- package/esm2022/utils/pipes/calculate-size/calculate-size.pipe.mjs +24 -0
- package/esm2022/utils/pipes/i18n/i18n.pipe.mjs +56 -0
- package/esm2022/utils/pipes/pipes.module.mjs +17 -0
- package/fesm2022/guajiritos-image-picker.mjs +614 -0
- package/fesm2022/guajiritos-image-picker.mjs.map +1 -0
- package/lib/guachos-image-picker.component.d.ts +23 -24
- package/package.json +13 -16
- package/theme.scss +66 -0
- package/utils/pipes/i18n/i18n.pipe.d.ts +9 -0
- package/utils/pipes/pipes.module.d.ts +8 -0
- package/esm2020/lib/guachos-image-picker.component.mjs +0 -548
- package/esm2020/utils/calculate-size.module.mjs +0 -16
- package/esm2020/utils/calculate-size.pipe.mjs +0 -24
- package/fesm2015/guajiritos-image-picker.mjs +0 -614
- package/fesm2015/guajiritos-image-picker.mjs.map +0 -1
- package/fesm2020/guajiritos-image-picker.mjs +0 -592
- package/fesm2020/guajiritos-image-picker.mjs.map +0 -1
- package/utils/calculate-size.module.d.ts +0 -7
- /package/{esm2020 → esm2022}/guajiritos-image-picker.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/utils/{calculate-size.pipe.d.ts → pipes/calculate-size/calculate-size.pipe.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Guachos Image Picker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular library based on angular material components for the selection, edition and compression of images in png, jpeg, webp formats
|
|
4
|
+
This library was generated with Angular CLI version 13.1.3, and support until angular version 10.0.2 to the latest version of angular.
|
|
4
5
|
|
|
5
6
|
### Description
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
In many projects it is of interest to upload and edit images, and sometimes we have to consult other programs for the compression of images and the change of format to improve the performance of the page. With `GuachosImagePicker` this is possible in real time with for each image that you want to upload.
|
|
8
9
|
|
|
9
10
|
### Installation
|
|
10
11
|
|
|
11
12
|
Using `npm`
|
|
12
13
|
|
|
13
14
|
```sh
|
|
14
|
-
npm i
|
|
15
|
+
npm i guachos-image-picker --save
|
|
15
16
|
```
|
|
16
17
|
Using `yarn`
|
|
17
18
|
|
|
18
19
|
```sh
|
|
19
|
-
yarn add
|
|
20
|
+
yarn add guachos-image-picker
|
|
20
21
|
```
|
|
21
22
|
|
|
22
|
-
`
|
|
23
|
+
`GuachosImagePicker` requires [Angular Material](https://material.angular.io/guide/getting-started/).
|
|
24
|
+
version 10.0.1 or higher
|
|
23
25
|
|
|
24
26
|
```sh
|
|
25
27
|
ng add @angular/material
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
### External Resource
|
|
30
|
+
Importing the BrowserAnimationsModule into your application enables Angular's animation system. Declining this will disable most of Angular Material's animations.
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
la interfaz de cambio de tamaño del observador informa de los cambios en las dimensiones del contenido de un Elemento o del cuadro de borde, o del cuadro delimitador de un SVGElement.
|
|
32
|
+
### External Resource
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
`GuachosImagePicker` use `resize-observer`, for the functionality of cropping images. The resize observer api is used
|
|
35
|
+
the resize observer interface reports changes to the dimensions of an Element's content or border box, or the bounding box of an SVGElement.
|
|
36
|
+
Install the package
|
|
35
37
|
|
|
36
38
|
Using `npm`
|
|
37
39
|
|
|
@@ -46,30 +48,27 @@ yarn add resize-observer
|
|
|
46
48
|
|
|
47
49
|
### Usages
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
You must import the module `GuachosImagePicker` where you will use it and use the component
|
|
50
52
|
|
|
51
|
-
```
|
|
52
|
-
import {
|
|
53
|
+
```typescript
|
|
54
|
+
import { GuachosImagePickerModule } from 'guachos-image-picker';
|
|
53
55
|
|
|
54
56
|
@NgModule({
|
|
55
|
-
...
|
|
56
57
|
imports: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
...
|
|
60
|
-
]
|
|
58
|
+
GuachosImagePickerModule
|
|
59
|
+
],
|
|
61
60
|
})
|
|
62
61
|
```
|
|
63
62
|
|
|
64
63
|
In your component:
|
|
65
64
|
|
|
66
65
|
```html
|
|
67
|
-
<
|
|
66
|
+
<guachos-image-picker [_config]="imagePickerConf" ($imageChanged)="onImageChange($event)"></guachos-image-picker>
|
|
68
67
|
```
|
|
69
68
|
|
|
70
|
-
|
|
69
|
+
In .ts file
|
|
71
70
|
|
|
72
|
-
```
|
|
71
|
+
```typescript
|
|
73
72
|
export class ExampleComponent {
|
|
74
73
|
imagePickerConf: ImagePickerConf = {
|
|
75
74
|
borderRadius: '4px',
|
|
@@ -80,9 +79,9 @@ export class ExampleComponent {
|
|
|
80
79
|
}
|
|
81
80
|
```
|
|
82
81
|
|
|
83
|
-
###
|
|
82
|
+
### Here is an example with different configurations
|
|
84
83
|
|
|
85
|
-
```
|
|
84
|
+
```typescript
|
|
86
85
|
export class ExampleComponent {
|
|
87
86
|
config1: ImagePickerConf = {
|
|
88
87
|
borderRadius: '16px',
|
|
@@ -103,21 +102,21 @@ export class ExampleComponent {
|
|
|
103
102
|
```
|
|
104
103
|
|
|
105
104
|
```html
|
|
106
|
-
<h2>
|
|
107
|
-
<
|
|
105
|
+
<h2>Basic usage</h2>
|
|
106
|
+
<guachos-image-picker [_config]="config1"></guachos-image-picker>
|
|
108
107
|
<br />
|
|
109
|
-
<h2>
|
|
110
|
-
<
|
|
108
|
+
<h2>Custom config</h2>
|
|
109
|
+
<guachos-image-picker [_config]="config2"></guachos-image-picker>
|
|
111
110
|
<br />
|
|
112
|
-
<h2>
|
|
113
|
-
<
|
|
111
|
+
<h2>Initial Image</h2>
|
|
112
|
+
<guachos-image-picker [_imageSrc]="initialImage" ($imageChanged)="onImageChanged($event)" [_config]="config3"> </guachos-image-picker>
|
|
114
113
|
```
|
|
115
114
|
|
|
116
|
-
###
|
|
115
|
+
### More about the component
|
|
117
116
|
|
|
118
|
-
|
|
117
|
+
The `GuachosImagePicker` component has a setting to change the width and length of the loaded image. In addition to the language (only 'es' and 'en'). It also has an initial compression option that by default is true. The interface looks like this:
|
|
119
118
|
|
|
120
|
-
```
|
|
119
|
+
```typescript
|
|
121
120
|
export interface ImagePickerConf {
|
|
122
121
|
width?: string;
|
|
123
122
|
height?: string;
|
|
@@ -127,14 +126,15 @@ export interface ImagePickerConf {
|
|
|
127
126
|
}
|
|
128
127
|
```
|
|
129
128
|
|
|
130
|
-
###
|
|
131
|
-
|
|
132
|
-
Una vez que haya seleccionado una imagen, se habilitarán tres botones debajo de la imagen:
|
|
129
|
+
### Editing panel
|
|
133
130
|
|
|
131
|
+
Once you have selected an image, three buttons are enabled below the image:
|
|
134
132
|
```text
|
|
135
|
-
1-
|
|
136
|
-
2-
|
|
137
|
-
3-
|
|
133
|
+
1- Load a new image.
|
|
134
|
+
2- Open the editing panel.
|
|
135
|
+
3- DOWNLOAD.
|
|
138
136
|
```
|
|
139
137
|
|
|
140
|
-
|
|
138
|
+
|
|
139
|
+
In the edit panel, you can change the quality ratio to compress the file size (in kb). Also changing width and height in px keeping aspect ratio or not, is selectable. You can change the image format as you wish, the options are 'png', 'webp','jpeg'. The 'Png' format is not affected by changing the quality ratio.
|
|
140
|
+
|