aurora-image-upload
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "aurora-image-upload", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"author": "Mohammad Ali Khandan", | ||
@@ -31,2 +31,2 @@ "license": "MIT", | ||
} | ||
} | ||
} |
@@ -1,24 +0,50 @@ | ||
# AuroraImageUpload | ||
# Aurora Image Upload Library | ||
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.1.0. | ||
This library provides a user-friendly component for uploading and validating images in Angular applications. It supports both file chooser and drag-and-drop methods for image uploading. | ||
## Code scaffolding | ||
## Key Features | ||
Run `ng generate component component-name --project aurora-image-upload` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project aurora-image-upload`. | ||
> Note: Don't forget to add `--project aurora-image-upload` or else it will be added to the default project in your `angular.json` file. | ||
- **Image Dimension Limitations**: Set maximum width and height for the uploaded image in pixels using the `max_width` and `max_height` inputs. This helps to ensure that the uploaded image fits within your application's design constraints. | ||
## Build | ||
- **Image Size Limitation**: Limit the size of the uploaded image using the `max_size` input. This input accepts the size in bytes, providing flexibility to set the limit based on your application's needs. | ||
Run `ng build aurora-image-upload` to build the project. The build artifacts will be stored in the `dist/` directory. | ||
- **Image Type Validation**: Restrict the types of images that can be uploaded using the `validImageTypes` input. This input accepts an array of image MIME types, allowing you to specify which image formats are valid for your application. | ||
## Publishing | ||
- **Initial Image Setting**: Pre-load an image in the upload component using the `initImageUrl` input. This is useful when you want to display a default image before the user uploads a new one. | ||
After building your library with `ng build aurora-image-upload`, go to the dist folder `cd dist/aurora-image-upload` and run `npm publish`. | ||
- **Image Upload Event**: The `uploadedImageFile` output emits the file of the uploaded image, allowing you to handle the image file in your application's logic. If the image is removed, it emits null. | ||
## Running unit tests | ||
## Installation | ||
Run `ng test aurora-image-upload` to execute the unit tests via [Karma](https://karma-runner.github.io). | ||
Install the library using npm: | ||
```bash | ||
npm install aurora-image-upload | ||
``` | ||
## Further help | ||
## Usage | ||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. | ||
Import the `AuroraImageUploadModule` in your Angular module: | ||
```typescript | ||
import { AuroraImageUploadModule } from 'aurora-image-upload'; | ||
@NgModule({ | ||
imports: [ | ||
// other imports | ||
AuroraImageUploadModule | ||
], | ||
// other properties | ||
}) | ||
export class AppModule { } | ||
``` | ||
Use the `aurora-image-upload` component in your Angular templates: | ||
```html | ||
<aurora-image-upload | ||
[max_height]="1000" | ||
[max_width]="1000" | ||
[max_size]="1000" | ||
[validImageTypes]="['image/jpeg', 'image/png']" | ||
[initImageUrl]="'https://example.com/image.jpg'" | ||
(uploadedImageFile)="handleImageUpload($event)"> | ||
</aurora-image-upload> | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128240
51