aurora-image-upload
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "aurora-image-upload", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"author": "Mohammad Ali Khandan", | ||
@@ -15,3 +15,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"tslib": "^2.3.0" | ||
"tslib": "^2.3.0", | ||
"@fortawesome/angular-fontawesome": "^0.13.0", | ||
"@fortawesome/fontawesome-svg-core": "^6.5.1", | ||
"@fortawesome/free-solid-svg-icons": "^6.5.1" | ||
}, | ||
@@ -32,2 +35,2 @@ "sideEffects": false, | ||
} | ||
} | ||
} |
@@ -1,50 +0,24 @@ | ||
# Aurora Image Upload Library | ||
# AuroraImageUpload | ||
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. | ||
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.1.0. | ||
## Key Features | ||
## Code scaffolding | ||
- **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. | ||
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 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. | ||
## Build | ||
- **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. | ||
Run `ng build aurora-image-upload` to build the project. The build artifacts will be stored in the `dist/` directory. | ||
- **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. | ||
## Publishing | ||
- **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. | ||
After building your library with `ng build aurora-image-upload`, go to the dist folder `cd dist/aurora-image-upload` and run `npm publish`. | ||
## Installation | ||
## Running unit tests | ||
Install the library using npm: | ||
```bash | ||
npm install aurora-image-upload | ||
``` | ||
Run `ng test aurora-image-upload` to execute the unit tests via [Karma](https://karma-runner.github.io). | ||
## Usage | ||
## Further help | ||
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> | ||
``` | ||
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. |
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
127420
6
25
+ Added@fortawesome/angular-fontawesome@0.13.0(transitive)
+ Added@fortawesome/fontawesome-common-types@6.6.0(transitive)
+ Added@fortawesome/fontawesome-svg-core@6.6.0(transitive)
+ Added@fortawesome/free-solid-svg-icons@6.6.0(transitive)