@guajiritos/image-picker 0.0.5 → 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 CHANGED
@@ -1,140 +1,140 @@
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
- Using `npm`
12
-
13
- ```sh
14
- npm i @guajiritos/image-picker --save
15
- ```
16
- Using `yarn`
17
-
18
- ```sh
19
- yarn add @guajiritos/image-picker
20
- ```
21
-
22
- `Guajiritos Image Picker` require [Angular Material](https://material.angular.io/guide/getting-started/).
23
-
24
- ```sh
25
- ng add @angular/material
26
- ```
27
-
28
- 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.
29
- ### External Resource
30
-
31
- `Guajiritos Image Picker` usa `resize-observer`, para la funcionalidad de recortar imágenes. Se utiliza la API de observador de cambio de tamaño
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.
33
-
34
- Instala la librería
35
-
36
- Using `npm`
37
-
38
- ```sh
39
- npm i resize-observer --save
40
- ```
41
- Using `yarn`
42
-
43
- ```sh
44
- yarn add resize-observer
45
- ```
46
-
47
- ### Usages
48
-
49
- Debes importar el módulo `Guajiritos Image Picker` donde lo usarás y usar el componente.
50
-
51
- ```ts
52
- import { GuajiritosImagePicker } from '@guajiritos/image-picker';
53
-
54
- @NgModule({
55
- ...
56
- imports: [
57
- ...
58
- GuajiritosImagePicker,
59
- ...
60
- ]
61
- })
62
- ```
63
-
64
- In your component:
65
-
66
- ```html
67
- <guajiritos-image-picker [_config]="imagePickerConf" ($imageChanged)="onImageChange($event)"></guajiritos-image-picker>
68
- ```
69
-
70
- En el componente .ts
71
-
72
- ```ts
73
- export class ExampleComponent {
74
- imagePickerConf: ImagePickerConf = {
75
- borderRadius: '4px',
76
- language: 'en',
77
- width: '320px',
78
- height: '240px',
79
- };
80
- }
81
- ```
82
-
83
- ### Aquí hay un ejemplo con diferentes configuraciones.
84
-
85
- ```ts
86
- export class ExampleComponent {
87
- config1: ImagePickerConf = {
88
- borderRadius: '16px',
89
- language: 'en',
90
- };
91
- config2: ImagePickerConf = {
92
- borderRadius: '50%',
93
- language: 'es',
94
- width: '200px',
95
- height: '200px',
96
- };
97
- config3: ImagePickerConf = {
98
- borderRadius: '4px',
99
- language: 'en',
100
- };
101
- initialImage = 'https://havanatursa.com/assets/images/multi-agencies/backgrounds/slider.jpg';
102
- }
103
- ```
104
-
105
- ```html
106
- <h2>Uso básico</h2>
107
- <guajiritos-image-picker [_config]="config1"></guajiritos-image-picker>
108
- <br />
109
- <h2>Configuración personalizada</h2>
110
- <guajiritos-image-picker [_config]="config2"></guajiritos-image-picker>
111
- <br />
112
- <h2>Imagen inicial</h2>
113
- <guajiritos-image-picker [_imageSrc]="initialImage" ($imageChanged)="onImageChanged($event)" [_config]="config3"></guajiritos-image-picker>
114
- ```
115
-
116
- ### Más sobre el componente
117
-
118
- 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í:
119
-
120
- ```ts
121
- export interface ImagePickerConf {
122
- width?: string;
123
- height?: string;
124
- borderRadius?: string;
125
- compressInitial?: boolean;
126
- language?: string;
127
- }
128
- ```
129
-
130
- ### Panel de edición
131
-
132
- Una vez que haya seleccionado una imagen, se habilitarán tres botones debajo de la imagen:
133
-
134
- ```text
135
- 1- Cargar una nueva imagen.
136
- 2- Abrir el panel de edición.
137
- 3- Descargar la imagen.
138
- ```
139
-
140
- 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
+ # Guachos Image Picker
2
+
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.
5
+
6
+ ### Description
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.
9
+
10
+ ### Installation
11
+
12
+ Using `npm`
13
+
14
+ ```sh
15
+ npm i guachos-image-picker --save
16
+ ```
17
+ Using `yarn`
18
+
19
+ ```sh
20
+ yarn add guachos-image-picker
21
+ ```
22
+
23
+ `GuachosImagePicker` requires [Angular Material](https://material.angular.io/guide/getting-started/).
24
+ version 10.0.1 or higher
25
+
26
+ ```sh
27
+ ng add @angular/material
28
+ ```
29
+
30
+ Importing the BrowserAnimationsModule into your application enables Angular's animation system. Declining this will disable most of Angular Material's animations.
31
+
32
+ ### External Resource
33
+
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
37
+
38
+ Using `npm`
39
+
40
+ ```sh
41
+ npm i resize-observer --save
42
+ ```
43
+ Using `yarn`
44
+
45
+ ```sh
46
+ yarn add resize-observer
47
+ ```
48
+
49
+ ### Usages
50
+
51
+ You must import the module `GuachosImagePicker` where you will use it and use the component
52
+
53
+ ```typescript
54
+ import { GuachosImagePickerModule } from 'guachos-image-picker';
55
+
56
+ @NgModule({
57
+ imports: [
58
+ GuachosImagePickerModule
59
+ ],
60
+ })
61
+ ```
62
+
63
+ In your component:
64
+
65
+ ```html
66
+ <guachos-image-picker [_config]="imagePickerConf" ($imageChanged)="onImageChange($event)"></guachos-image-picker>
67
+ ```
68
+
69
+ In .ts file
70
+
71
+ ```typescript
72
+ export class ExampleComponent {
73
+ imagePickerConf: ImagePickerConf = {
74
+ borderRadius: '4px',
75
+ language: 'en',
76
+ width: '320px',
77
+ height: '240px',
78
+ };
79
+ }
80
+ ```
81
+
82
+ ### Here is an example with different configurations
83
+
84
+ ```typescript
85
+ export class ExampleComponent {
86
+ config1: ImagePickerConf = {
87
+ borderRadius: '16px',
88
+ language: 'en',
89
+ };
90
+ config2: ImagePickerConf = {
91
+ borderRadius: '50%',
92
+ language: 'es',
93
+ width: '200px',
94
+ height: '200px',
95
+ };
96
+ config3: ImagePickerConf = {
97
+ borderRadius: '4px',
98
+ language: 'en',
99
+ };
100
+ initialImage = 'https://havanatursa.com/assets/images/multi-agencies/backgrounds/slider.jpg';
101
+ }
102
+ ```
103
+
104
+ ```html
105
+ <h2>Basic usage</h2>
106
+ <guachos-image-picker [_config]="config1"></guachos-image-picker>
107
+ <br />
108
+ <h2>Custom config</h2>
109
+ <guachos-image-picker [_config]="config2"></guachos-image-picker>
110
+ <br />
111
+ <h2>Initial Image</h2>
112
+ <guachos-image-picker [_imageSrc]="initialImage" ($imageChanged)="onImageChanged($event)" [_config]="config3"> </guachos-image-picker>
113
+ ```
114
+
115
+ ### More about the component
116
+
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:
118
+
119
+ ```typescript
120
+ export interface ImagePickerConf {
121
+ width?: string;
122
+ height?: string;
123
+ borderRadius?: string;
124
+ compressInitial?: boolean;
125
+ language?: string;
126
+ }
127
+ ```
128
+
129
+ ### Editing panel
130
+
131
+ Once you have selected an image, three buttons are enabled below the image:
132
+ ```text
133
+ 1- Load a new image.
134
+ 2- Open the editing panel.
135
+ 3- DOWNLOAD.
136
+ ```
137
+
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
+