Gathering detailed insights and metrics for @t.simon/ionic-image-viewer
Gathering detailed insights and metrics for @t.simon/ionic-image-viewer
Gathering detailed insights and metrics for @t.simon/ionic-image-viewer
Gathering detailed insights and metrics for @t.simon/ionic-image-viewer
An Ionic Angular component to view & zoom on images and photos without any additional dependencies.
npm install @t.simon/ionic-image-viewer
Typescript
Module System
Node Version
NPM Version
53.1
Supply Chain
92.8
Quality
75.9
Maintenance
100
Vulnerability
98.2
License
TypeScript (61.98%)
SCSS (20.33%)
HTML (12.45%)
JavaScript (5.24%)
Total Downloads
2,537
Last Day
1
Last Week
3
Last Month
52
Last Year
690
MIT License
147 Commits
1 Branches
1 Contributors
Updated on Sep 15, 2023
Minified
Minified + Gzipped
Latest Version
2.1.8
Package Id
@t.simon/ionic-image-viewer@2.1.8
Unpacked Size
183.38 kB
Size
30.44 kB
File Count
21
NPM Version
9.8.1
Node Version
18.13.0
Published on
Sep 15, 2023
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
50%
3
Compared to previous week
Last Month
-50.5%
52
Compared to previous month
Last Year
-62.6%
690
Compared to previous year
This repo is a fork of ngx-ionic-image-viewer. This repo uses latest version of angular and is ivy compatible
An Ionic Angular module to view & zoom on images and photos works with swiperjs, so it works with Ionic7.
1npm install --save npm i @t.simon/ionic-image-viewer
Import the module and add it to your imports section in your main AppModule:
1import {NgxIonicImageViewerModule} from '@t.simon/ionic-image-viewer'; 2 3... 4 5@NgModule({ 6 imports: [ 7 NgxIonicImageViewerModule 8 ], 9}) 10export class AppModule { 11}
Import the module and add it to your imports section of your component where you want to use it (e.g. home.module.ts
):
1import {NgxIonicImageViewerModule} from '@t.simon/ionic-image-viewer'; 2 3... 4 5@NgModule({ 6 imports: [ 7 NgxIonicImageViewerModule 8 ], 9}) 10export class HomePageModule { 11} 12
Add ion-img-viewer
within the HTML of your module (e.g. home.page.html
)
1 2<ion-img-viewer 3 title="Demo" 4 text="Component" 5 scheme="dark" 6 src="./assets/img/demo.jpg" 7> 8</ion-img-viewer>
Add ionImgViewer
as a directive within the ion-img
HTML element of your module (e.g. home.page.html
)
1 2<ion-img 3 ionImgViewer 4 title="Demo" 5 text="Directive" 6 scheme="light" 7 src="./assets/img/demo.jpg" 8> 9</ion-img>
Import ViewerModalComponent
from @t.simon/ionic-image-viewer
and add it to the ModalController
. Within the componentProps
, all available properties can be passed, whereby src
is always required. In addition you must add the css class ion-img-viewer
to the property cssClass
.
Use cssClass: ['ion-img-viewer', 'my-custom-ion-img-viewer']
in case you want to add more css classes.
1import {ModalController} from '@ionic/angular'; 2import {ViewerModalComponent} from '@t.simon/ionic-image-viewer'; 3 4export class HomePage { 5 6 constructor(public 7 8 modalController: ModalController 9) { 10} 11 12async 13openViewer() 14{ 15 const modal = await this.modalController.create({ 16 component: ViewerModalComponent, 17 componentProps: { 18 src: "./assets/img/demo.jpg" 19 }, 20 cssClass: 'ion-img-viewer', 21 keyboardClose: true, 22 showBackdrop: true 23 }); 24 25 return await modal.present(); 26} 27}
1 2<ion-button (click)="openViewer()">Open Viewer</ion-button>
alt | |
---|---|
Description | This attribute defines the alternative text describing the image. Users will see this text displayed if the image URL is wrong, the image is not in one of the supported formats, or if the image is not yet downloaded. |
Attribute | alt |
Type | string | undefined |
cssClass | |
Description | Additional classes to apply for custom CSS. If multiple classes are provided they should be separated by spaces. |
Attribute | cssClass |
Type | string | string[] | undefined |
scheme | |
Description | Sets the color scheme. |
Attribute | scheme |
Type | "auto" | "dark" | "light" | undefined |
Default | "auto" |
slideOptions | |
Description | Options to pass to the swiper instance. See http://idangero.us/swiper/api/ for valid options. |
Attribute | slideOptions |
Type | object | undefined |
Default | { centeredSlides: true, passiveListeners: false, zoom: { enabled: true } } |
src | |
Description | The image url. This attribute is mandatory for the <img> element. |
Attribute | src |
Type | string | undefined |
srcFallback | |
Description | The image url to display an alternative image in case the original image could not be loaded. Similiar to (error)="src=./assets/no-image.png" |
Attribute | srcFallback |
Type | string | undefined |
srcHighRes | |
Description | The image url to display a high-resolution image instead of the original image when opening the viewer. |
Attribute | srcHighRes |
Type | string | undefined |
swipeToClose | |
Description | Swipe down to close the viewer. |
Attribute | swipeToClose |
Type | boolean | undefined |
Default | true |
text | |
Description | Sets the text in the footer of the viewer. |
Attribute | text |
Type | string | undefined |
title | |
Description | Sets the title in the header of the viewer. |
Attribute | title |
Type | string | undefined |
titleSize | |
Description | The size of the title. |
Attribute | titleSize |
Type | "large" | "small" | undefined |
This project was generated with Angular CLI version 8.3.14.
Run the command to start the build every time a file change:
1npm run build:watch
Run the command to create a local symlink and start a local dev server fo app dev/testing.
1npm run ionic:serve
npm link
: Create a local symlink that can then be used in the project where you want to integrate the package as you don’t want to build, publish and update a library all the time while testing.npm link @t.simon/ionic-image-viewer
inside the libs folder to link the global installation target into your project’s node_modules
folder.ionic serve
: Start a local dev server for app dev/testing. Navigate to http://localhost:8100/
. The app will automatically reload if you change any of the source files.Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Check
package.json
for lifecycle events
Run npm run release
to create a new build & release with release-it
. This bumps the version of libs/ngx-ionic-image-viewer/package.json
, uses conventional-changelog to update CHANGELOG.md, commits package.json and CHANGELOG.md and tags a new release. The new release gets published to GitHub and npm automatically.
Check
package.json
and.release-it.json
for lifecycle events
Once the confirmation of npm has been received, the command npm run demo:update
can be run to update the demo to the latest version and commit the change.
After building your library with ng build ngx-ionic-image-viewer
, go to the dist folder cd dist/ngx-ionic-image-viewer
and run npm publish
.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.
Run npx git-cz
to generate a valid commit message. It’s easy to forget about the commit convention so to be consistent use commitizen to generate our commits and husky to manage a Git commit-msg hook to validate the commit message.
Further information: How to automate versioning and publication of an npm package
Thomas Simon
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Copyright © 2023 Thomas Simon.
This project is MIT licensed.
No vulnerabilities found.
No security vulnerabilities found.