npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@guajiritos/image-picker

v17.1.4

Published

Biblioteca de angular basada en componentes de material angular para la selección, edición y compresión de imágenes en formatos png, jpeg, webp

Downloads

407

Readme

Guajiritos Image Picker

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.

Description

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.

Installation

Con npm

npm i @guajiritos/image-picker --save

Con yarn

yarn add @guajiritos/image-picker

Con pnpm

pnpm add @guajiritos/image-picker

Guajiritos Image Picker requiere Angular Material.

ng add @angular/material

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.

External Resource

Guajiritos Image Picker usa resize-observer, para la funcionalidad de recortar imágenes. Se utiliza la API de observador de cambio de tamaño 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.

Instala la librería

Con npm

npm i resize-observer --save

Con yarn

yarn add resize-observer

Con pnpm

pnpm add resize-observer

Usages

Debes importar el módulo Guajiritos Image Picker donde lo usarás y usar el componente.

import { GuajiritosImagePicker } from '@guajiritos/image-picker';

@NgModule({
  imports: [
    GuajiritosImagePicker
  ]
})

In your component:

<guajiritos-image-picker [_config]="imagePickerConf" ($imageChanged)="onImageChange($event)"></guajiritos-image-picker>

En el componente .ts

export class ExampleComponent {
  imagePickerConf: ImagePickerConf = {
    borderRadius: '4px',
    language: 'en',
    width: '320px',
    height: '240px',
  };
}

Aquí hay un ejemplo con diferentes configuraciones.

export class ExampleComponent {
  config1: ImagePickerConf = {
    borderRadius: '16px',
    language: 'en',
  };
  config2: ImagePickerConf = {
    borderRadius: '50%',
    language: 'es',
    width: '200px',
    height: '200px',
  };
  config3: ImagePickerConf = {
    borderRadius: '4px',
    language: 'en',
  };
  initialImage = 'https://havanatursa.com/assets/images/multi-agencies/backgrounds/slider.jpg';
}
<h2>Uso básico</h2>
<guajiritos-image-picker [_config]="config1"></guajiritos-image-picker>
<br />
<h2>Configuración personalizada</h2>
<guajiritos-image-picker [_config]="config2"></guajiritos-image-picker>
<br />
<h2>Imagen inicial</h2>
<guajiritos-image-picker [_imageSrc]="initialImage" ($imageChanged)="onImageChanged($event)" [_config]="config3"></guajiritos-image-picker>

Más sobre el componente

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í:

export interface ImagePickerConf {
  width?: string;
  height?: string;
  borderRadius?: string;
  compressInitial?: boolean;
  language?: string;
}

Panel de edición

Una vez que haya seleccionado una imagen, se habilitarán tres botones debajo de la imagen:

1- Cargar una nueva imagen.
2- Abrir el panel de edición.
3- Descargar la imagen.

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.