Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-ionic-image-viewer

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-ionic-image-viewer

An Ionic 4 Angular module to view & zoom on images and photos without any additional dependencies.

  • 0.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
725
increased by10.52%
Maintainers
1
Weekly downloads
 
Created
Source

ngx-ionic-image-viewer

NPM Version Documentation Maintenance Conventional Commits Standard Version License: MIT

An Ionic 4 Angular module to view & zoom on images and photos without any additional dependencies.

Demo

Live Demo | Stackblitz

ngx-ionic-image-viewer-showcase

Overview

Prerequisites

  • ionic >= 4.0.0
  • angular >= 8.0.0

Installation

npm install --save ngx-ionic-image-viewer

Usage

Import

Import the module and add it to your imports section in your main AppModule:

import { NgxIonicImageViewerModule } from 'ngx-ionic-image-viewer';

...

@NgModule({
  imports: [
    NgxIonicImageViewerModule
  ],
})
export class AppModule {}

Import the module and add it to your imports section of your component where you want to use it (e.g. home.module.ts):

import { NgxIonicImageViewerModule } from 'ngx-ionic-image-viewer';

...

@NgModule({
  imports: [
    NgxIonicImageViewerModule
  ],
})
export class HomePageModule {}

Component

Add ion-img-viewer within the HTML of your module (e.g. home.page.html)

<ion-img-viewer 
  title="Demo" 
  text="Component" 
  scheme="dark" 
  src="./assets/img/demo.jpg">
</ion-img-viewer>

Directive

Add ionImgViewer as a directive within the ion-img HTML element of your module (e.g. home.page.html)

<ion-img 
  ionImgViewer 
  title="Demo" 
  text="Directive" 
  scheme="light" 
  src="./assets/img/demo.jpg">
</ion-img>

Properties

alt

DescriptionThis 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.
Attributealt
Typestring | undefined

scheme

DescriptionSets the color scheme.
Attributescheme
Type"auto" | "dark" | "light" | undefined
Default"auto"

slideOptions

DescriptionOptions to pass to the swiper instance. See http://idangero.us/swiper/api/ for valid options.
AttributeslideOptions
Typeobject | undefined
Default{ centeredSlides: true, passiveListeners: false, zoom: { enabled: true } }

src

DescriptionThe image url. This attribute is mandatory for the <img> element.
Attributesrc
Typestring | undefined

srcFallback

DescriptionThe image url to display an alternative image in case the original image could not be loaded. Similiar to (error)="src=./assets/no-image.png"
AttributesrcFallback
Typestring | undefined

srcHighRes

DescriptionThe image url to display a high-resolution image instead of the original image when opening the viewer.
AttributesrcHighRes
Typestring | undefined

swipeToClose

DescriptionSwipe down to close the viewer.
AttributeswipeToClose
Typeboolean | undefined
Defaulttrue

text

DescriptionSets the text in the footer of the viewer.
Attributetext
Typestring | undefined

title

DescriptionSets the title in the header of the viewer.
Attributetitle
Typestring | undefined

Workspace

This project was generated with Angular CLI version 8.3.14.

Local Development

  1. Run the command to start the build every time a file change:

    npm run build:watch
    
  2. Run the command to create a local symlink and start a local dev server fo app dev/testing.

    npm 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.
    • Run the command npm link ngx-ionic-image-viewer inside the projects 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.

Code scaffolding

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.

Build

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

Release & Publishing

Run npm run release to create a new build & release with release-it. This bumps the version of projects/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.

Manual Publishing

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.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

Committing

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

Author

Simon Golms

  • Digital Card: npx simongolms
  • Github: @simongolms
  • Website: gol.ms

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

License

Copyright © 2019 Simon Golms.
This project is MIT licensed.

Keywords

FAQs

Package last updated on 06 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc