{"id":18881927,"url":"https://github.com/matheusdavidson/angular-upcrop","last_synced_at":"2025-04-14T20:30:34.123Z","repository":{"id":57179322,"uuid":"103602580","full_name":"matheusdavidson/angular-upcrop","owner":"matheusdavidson","description":"Library with upload and crop feature for Angular 4+","archived":false,"fork":false,"pushed_at":"2019-03-01T18:56:32.000Z","size":237,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T08:41:44.586Z","etag":null,"topics":["angular","angular-component","angular-library","angular2","angular4","cropper","cropperjs","image","ng2-file-upload","upload"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matheusdavidson.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-15T02:04:28.000Z","updated_at":"2022-02-17T12:02:27.000Z","dependencies_parsed_at":"2022-09-14T02:10:32.774Z","dependency_job_id":null,"html_url":"https://github.com/matheusdavidson/angular-upcrop","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusdavidson%2Fangular-upcrop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusdavidson%2Fangular-upcrop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusdavidson%2Fangular-upcrop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusdavidson%2Fangular-upcrop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matheusdavidson","download_url":"https://codeload.github.com/matheusdavidson/angular-upcrop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248543853,"owners_count":21121838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular-component","angular-library","angular2","angular4","cropper","cropperjs","image","ng2-file-upload","upload"],"created_at":"2024-11-08T06:52:32.080Z","updated_at":"2025-04-14T20:30:33.848Z","avatar_url":"https://github.com/matheusdavidson.png","language":"TypeScript","readme":"# angular-upcrop\n\nLibrary with upload and crop feature for Angular 6+\n\n## How to use\n\n1- Install `angular-upcrop`\n\n```bash\n$ npm install angular-upcrop --save\n```\n\n2- Add `angular-upcrop` to the module you want to use, for example: `AppModule`\n\n```typescript\nimport { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\n\nimport { AppComponent } from './app.component';\n\n//\n// Import and load UpcropModule\nimport { UpcropModule } from 'angular-upcrop';\n\n@NgModule({\n  declarations: [\n    AppComponent\n  ],\n  imports: [\n    BrowserModule,\n\n    //\n    // Load UpcropModule\n    UpcropModule\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n\n3- Now you need to create an action for some button inside your component and trigger the `open` method in `UpcropService`\n\n*Import `UpcropService` in the component you want to use, for example: `AppComponentModule`, add to the providers section then create an action to trigger `open()`*\n\n```typescript\n\n//\n// Import the service\nimport { UpcropService } from 'angular-upcrop';\n\n@Component({\n\n  ...\n\n  //\n  // Add UpcropService to the component providers\n  providers: [UpcropService],\n\n  ...\n})\nexport class AppComponentModule { \n\n  ...\n\n  //\n  // Create a method in the component to trigger upcrop\n  openUpcrop() {\n\n    // \n    // Set config for dialog, upload and crop components\n    let dialogConfig = {};\n    let uploadConfig = {\n        url: environment.api + 'products/models/upload',\n        additionalParameter: {}\n    };\n    let cropConfig = {};\n\n    // \n    // Open upcrop dialog\n    this.upcropService.open(dialogConfig, uploadConfig, cropConfig).then((data) =\u003e {\n\n        // \n        // Data will contain an array with the images\n        data;\n    }).catch((err) =\u003e {\n    });\n  }\n\n  ...\n\n}\n```\n\n*Now you just need to call the `openUpcrop` method you've created*\n```html\n\u003cbutton (click)=\"openUpcrop()\"\u003eOpen upcrop\u003c/button\u003e\n```\n\n## Development\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.8.\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).\n\n## License\n\nMIT © [Matheus Davidson](mailto:matheusdavidson@gmail.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheusdavidson%2Fangular-upcrop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatheusdavidson%2Fangular-upcrop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheusdavidson%2Fangular-upcrop/lists"}