@guajiritos/image-picker 18.0.1 → 18.0.3
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 +149 -149
- package/esm2022/lib/guachos-image-picker.component.mjs +5 -5
- package/esm2022/public-api.mjs +1 -1
- package/esm2022/utils/pipes/calculate-size/calculate-size.pipe.mjs +4 -4
- package/esm2022/utils/pipes/i18n/i18n.pipe.mjs +4 -4
- package/esm2022/utils/pipes/pipes.module.mjs +5 -5
- package/fesm2022/guajiritos-image-picker.mjs +15 -15
- package/fesm2022/guajiritos-image-picker.mjs.map +1 -1
- package/package.json +1 -1
- package/theme.scss +77 -77
package/README.md
CHANGED
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
# Guajiritos Image Picker
|
|
2
|
-
|
|
3
|
-
Biblioteca angular basada en componentes de material angular para la selección, edición y compresión de imágenes en formatos png, jpeg, webp.
|
|
4
|
-
|
|
5
|
-
### Description
|
|
6
|
-
|
|
7
|
-
En muchos proyectos interesa subir y editar imágenes, y en ocasiones tenemos que consultar otros programas para la compresión de imágenes y el cambio de formato para mejorar el rendimiento de la página. Con `Guajiritos Image Picker` esto es posible en tiempo real con cada imagen que quieras subir.
|
|
8
|
-
|
|
9
|
-
### Installation
|
|
10
|
-
|
|
11
|
-
Con `npm`
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
npm i @guajiritos/image-picker --save
|
|
15
|
-
```
|
|
16
|
-
Con `yarn`
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
yarn add @guajiritos/image-picker
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Con `pnpm`
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
pnpm add @guajiritos/image-picker
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
`Guajiritos Image Picker` requiere [Angular Material](https://material.angular.io/guide/getting-started/).
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
ng add @angular/material
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
La importación de `BrowserAnimationsModule` a su aplicación habilita el sistema de animación de Angular. Rechazar esto deshabilitará la mayoría de las animaciones de Angular Material.
|
|
35
|
-
### External Resource
|
|
36
|
-
|
|
37
|
-
`Guajiritos Image Picker` usa `resize-observer`, para la funcionalidad de recortar imágenes. Se utiliza la API de observador de cambio de tamaño
|
|
38
|
-
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.
|
|
39
|
-
|
|
40
|
-
Instala la librería
|
|
41
|
-
|
|
42
|
-
Con `npm`
|
|
43
|
-
|
|
44
|
-
```sh
|
|
45
|
-
npm i resize-observer --save
|
|
46
|
-
```
|
|
47
|
-
Con `yarn`
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
yarn add resize-observer
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Con `pnpm`
|
|
54
|
-
|
|
55
|
-
```sh
|
|
56
|
-
pnpm add resize-observer
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Usages
|
|
60
|
-
|
|
61
|
-
Debes importar el módulo `Guajiritos Image Picker` donde lo usarás y usar el componente.
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
import { GuajiritosImagePicker } from '@guajiritos/image-picker';
|
|
65
|
-
|
|
66
|
-
@NgModule({
|
|
67
|
-
imports: [
|
|
68
|
-
GuajiritosImagePicker
|
|
69
|
-
]
|
|
70
|
-
})
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
In your component:
|
|
74
|
-
|
|
75
|
-
```html
|
|
76
|
-
<guajiritos-image-picker [_config]="imagePickerConf" ($imageChanged)="onImageChange($event)"></guajiritos-image-picker>
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
En el componente .ts
|
|
80
|
-
|
|
81
|
-
```ts
|
|
82
|
-
export class ExampleComponent {
|
|
83
|
-
imagePickerConf: ImagePickerConf = {
|
|
84
|
-
borderRadius: '4px',
|
|
85
|
-
language: 'en',
|
|
86
|
-
width: '320px',
|
|
87
|
-
height: '240px',
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Aquí hay un ejemplo con diferentes configuraciones.
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
export class ExampleComponent {
|
|
96
|
-
config1: ImagePickerConf = {
|
|
97
|
-
borderRadius: '16px',
|
|
98
|
-
language: 'en',
|
|
99
|
-
};
|
|
100
|
-
config2: ImagePickerConf = {
|
|
101
|
-
borderRadius: '50%',
|
|
102
|
-
language: 'es',
|
|
103
|
-
width: '200px',
|
|
104
|
-
height: '200px',
|
|
105
|
-
};
|
|
106
|
-
config3: ImagePickerConf = {
|
|
107
|
-
borderRadius: '4px',
|
|
108
|
-
language: 'en',
|
|
109
|
-
};
|
|
110
|
-
initialImage = 'https://havanatursa.com/assets/images/multi-agencies/backgrounds/slider.jpg';
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
```html
|
|
115
|
-
<h2>Uso básico</h2>
|
|
116
|
-
<guajiritos-image-picker [_config]="config1"></guajiritos-image-picker>
|
|
117
|
-
<br />
|
|
118
|
-
<h2>Configuración personalizada</h2>
|
|
119
|
-
<guajiritos-image-picker [_config]="config2"></guajiritos-image-picker>
|
|
120
|
-
<br />
|
|
121
|
-
<h2>Imagen inicial</h2>
|
|
122
|
-
<guajiritos-image-picker [_imageSrc]="initialImage" ($imageChanged)="onImageChanged($event)" [_config]="config3"></guajiritos-image-picker>
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Más sobre el componente
|
|
126
|
-
|
|
127
|
-
El componente `Guajiritos Image Picker` tiene una configuración para cambiar el ancho y largo de la imagen cargada. Además del idioma (solo 'es' y 'en'). También tiene una opción de compresión inicial que por defecto es true. La interfaz se ve así:
|
|
128
|
-
|
|
129
|
-
```ts
|
|
130
|
-
export interface ImagePickerConf {
|
|
131
|
-
width?: string;
|
|
132
|
-
height?: string;
|
|
133
|
-
borderRadius?: string;
|
|
134
|
-
compressInitial?: boolean;
|
|
135
|
-
language?: string;
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### Panel de edición
|
|
140
|
-
|
|
141
|
-
Una vez que haya seleccionado una imagen, se habilitarán tres botones debajo de la imagen:
|
|
142
|
-
|
|
143
|
-
```text
|
|
144
|
-
1- Cargar una nueva imagen.
|
|
145
|
-
2- Abrir el panel de edición.
|
|
146
|
-
3- Descargar la imagen.
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
En el panel de edición, puede cambiar la relación de calidad para comprimir el tamaño del archivo (en kb). También se puede seleccionar el cambio de ancho y alto en px manteniendo la relación de aspecto o no. Puede cambiar el formato de la imagen como desee, las opciones son 'png', 'webp', 'jpeg'. El formato 'Png' no se ve afectado por cambiar la relación de calidad.
|
|
1
|
+
# Guajiritos Image Picker
|
|
2
|
+
|
|
3
|
+
Biblioteca angular basada en componentes de material angular para la selección, edición y compresión de imágenes en formatos png, jpeg, webp.
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
En muchos proyectos interesa subir y editar imágenes, y en ocasiones tenemos que consultar otros programas para la compresión de imágenes y el cambio de formato para mejorar el rendimiento de la página. Con `Guajiritos Image Picker` esto es posible en tiempo real con cada imagen que quieras subir.
|
|
8
|
+
|
|
9
|
+
### Installation
|
|
10
|
+
|
|
11
|
+
Con `npm`
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm i @guajiritos/image-picker --save
|
|
15
|
+
```
|
|
16
|
+
Con `yarn`
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
yarn add @guajiritos/image-picker
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Con `pnpm`
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
pnpm add @guajiritos/image-picker
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`Guajiritos Image Picker` requiere [Angular Material](https://material.angular.io/guide/getting-started/).
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
ng add @angular/material
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
La importación de `BrowserAnimationsModule` a su aplicación habilita el sistema de animación de Angular. Rechazar esto deshabilitará la mayoría de las animaciones de Angular Material.
|
|
35
|
+
### External Resource
|
|
36
|
+
|
|
37
|
+
`Guajiritos Image Picker` usa `resize-observer`, para la funcionalidad de recortar imágenes. Se utiliza la API de observador de cambio de tamaño
|
|
38
|
+
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.
|
|
39
|
+
|
|
40
|
+
Instala la librería
|
|
41
|
+
|
|
42
|
+
Con `npm`
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm i resize-observer --save
|
|
46
|
+
```
|
|
47
|
+
Con `yarn`
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
yarn add resize-observer
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Con `pnpm`
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
pnpm add resize-observer
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Usages
|
|
60
|
+
|
|
61
|
+
Debes importar el módulo `Guajiritos Image Picker` donde lo usarás y usar el componente.
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { GuajiritosImagePicker } from '@guajiritos/image-picker';
|
|
65
|
+
|
|
66
|
+
@NgModule({
|
|
67
|
+
imports: [
|
|
68
|
+
GuajiritosImagePicker
|
|
69
|
+
]
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
In your component:
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<guajiritos-image-picker [_config]="imagePickerConf" ($imageChanged)="onImageChange($event)"></guajiritos-image-picker>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
En el componente .ts
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
export class ExampleComponent {
|
|
83
|
+
imagePickerConf: ImagePickerConf = {
|
|
84
|
+
borderRadius: '4px',
|
|
85
|
+
language: 'en',
|
|
86
|
+
width: '320px',
|
|
87
|
+
height: '240px',
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Aquí hay un ejemplo con diferentes configuraciones.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
export class ExampleComponent {
|
|
96
|
+
config1: ImagePickerConf = {
|
|
97
|
+
borderRadius: '16px',
|
|
98
|
+
language: 'en',
|
|
99
|
+
};
|
|
100
|
+
config2: ImagePickerConf = {
|
|
101
|
+
borderRadius: '50%',
|
|
102
|
+
language: 'es',
|
|
103
|
+
width: '200px',
|
|
104
|
+
height: '200px',
|
|
105
|
+
};
|
|
106
|
+
config3: ImagePickerConf = {
|
|
107
|
+
borderRadius: '4px',
|
|
108
|
+
language: 'en',
|
|
109
|
+
};
|
|
110
|
+
initialImage = 'https://havanatursa.com/assets/images/multi-agencies/backgrounds/slider.jpg';
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<h2>Uso básico</h2>
|
|
116
|
+
<guajiritos-image-picker [_config]="config1"></guajiritos-image-picker>
|
|
117
|
+
<br />
|
|
118
|
+
<h2>Configuración personalizada</h2>
|
|
119
|
+
<guajiritos-image-picker [_config]="config2"></guajiritos-image-picker>
|
|
120
|
+
<br />
|
|
121
|
+
<h2>Imagen inicial</h2>
|
|
122
|
+
<guajiritos-image-picker [_imageSrc]="initialImage" ($imageChanged)="onImageChanged($event)" [_config]="config3"></guajiritos-image-picker>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Más sobre el componente
|
|
126
|
+
|
|
127
|
+
El componente `Guajiritos Image Picker` tiene una configuración para cambiar el ancho y largo de la imagen cargada. Además del idioma (solo 'es' y 'en'). También tiene una opción de compresión inicial que por defecto es true. La interfaz se ve así:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
export interface ImagePickerConf {
|
|
131
|
+
width?: string;
|
|
132
|
+
height?: string;
|
|
133
|
+
borderRadius?: string;
|
|
134
|
+
compressInitial?: boolean;
|
|
135
|
+
language?: string;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Panel de edición
|
|
140
|
+
|
|
141
|
+
Una vez que haya seleccionado una imagen, se habilitarán tres botones debajo de la imagen:
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
1- Cargar una nueva imagen.
|
|
145
|
+
2- Abrir el panel de edición.
|
|
146
|
+
3- Descargar la imagen.
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
En el panel de edición, puede cambiar la relación de calidad para comprimir el tamaño del archivo (en kb). También se puede seleccionar el cambio de ancho y alto en px manteniendo la relación de aspecto o no. Puede cambiar el formato de la imagen como desee, las opciones son 'png', 'webp', 'jpeg'. El formato 'Png' no se ve afectado por cambiar la relación de calidad.
|