All Projects → SimonGolms → ngx-ionic-image-viewer

SimonGolms / ngx-ionic-image-viewer

Licence: MIT License
An Ionic 4 Angular component to view & zoom on images and photos without any additional dependencies.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
SCSS
7915 projects
shell
77523 projects

Projects that are alternatives of or similar to ngx-ionic-image-viewer

ionic4-angular7-example
Ionic 4, Angular 7 and Cordova Tutorial: Build CRUD Mobile Apps
Stars: ✭ 57 (-55.81%)
Mutual labels:  ionic, ionic-framework, ionic4
ionic-uber-clone
Ionic 4 Taxi Booking script
Stars: ✭ 34 (-73.64%)
Mutual labels:  ionic, ionic-framework, ionic4
ionic4-ngrx-firebase
A basic application for Ionic 4 with firebase & ngrx actions, reducers and effects
Stars: ✭ 17 (-86.82%)
Mutual labels:  ionic, ionic-framework, ionic4
ionic-modal-custom-transitions
Add Custom Transitions to Ionic Modals.
Stars: ✭ 22 (-82.95%)
Mutual labels:  ionic, ionic-framework, ionic4
ionic-signature-pad
Ionic plugin to input singnature pad
Stars: ✭ 15 (-88.37%)
Mutual labels:  ionic, ionic-framework, ionic4
example-cordova-code-push-plugin
Ionic + Cordova Code Push Plugin Example
Stars: ✭ 45 (-65.12%)
Mutual labels:  ionic, ionic4
ionic4-phaser3-template
Ionic 4 and phaser 3 template
Stars: ✭ 19 (-85.27%)
Mutual labels:  ionic-framework, ionic4
tutorial-photo-gallery-vue
Photo Gallery Tutorial: Ionic Vue and Capacitor
Stars: ✭ 33 (-74.42%)
Mutual labels:  ionic, ionic-framework
ionic-surveyjs
Sample project that shows how to integrate SurveyJS in Ionic APP.
Stars: ✭ 28 (-78.29%)
Mutual labels:  ionic, ionic-framework
ionic-image-upload
Ionic Plugin for Uploading Images to Amazon S3
Stars: ✭ 26 (-79.84%)
Mutual labels:  ionic, ionic-framework
talks
Let's talk about ..
Stars: ✭ 13 (-89.92%)
Mutual labels:  ionic, ionic-framework
fireblogger
Ionic 2 social media microblogging platform built with firebase 3 as backend
Stars: ✭ 54 (-58.14%)
Mutual labels:  ionic, ionic-framework
ionic-firebase-image-upload
Building an Ionic App with Protected/Private Content. This app shows how to use Firebase Storage from an Ionic Angular app both with public and private content.
Stars: ✭ 19 (-85.27%)
Mutual labels:  ionic, ionic-framework
ionic-audio-player
A simple audio player created with Ionic 4+ / Angular 8+ (updated in Aug 2019)
Stars: ✭ 72 (-44.19%)
Mutual labels:  ionic, ionic4
ionic-truncated-slider-cards
Customized slider component to achieve a fancy horizontal truncated slider, basically for short list of cards
Stars: ✭ 19 (-85.27%)
Mutual labels:  ionic, ionic4
keyonic-v2
A Keycloak Mobile Implementation using Angular v4 and Ionic v3
Stars: ✭ 23 (-82.17%)
Mutual labels:  ionic, ionic-framework
ionic4-angular6-crud-example
Building CRUD Mobile App using Ionic 4, Angular 6 and Cordova
Stars: ✭ 50 (-61.24%)
Mutual labels:  ionic, ionic-framework
todo-list
TodoList using Ionic2/3 & Firebase: * PWA * SSO Google plus. * Share list via QRcode. * Upload image from Camera or Storage. * Speech Recognition.
Stars: ✭ 18 (-86.05%)
Mutual labels:  ionic, ionic-framework
angular-progress-bar
This component allow you to easy incorporate progress-bar to angular/ionic project, providing binding and color options
Stars: ✭ 26 (-79.84%)
Mutual labels:  ionic, ionic4
ionic-3-video-calling-using-webrtc
This is demo code of how to implement video calling in ionic 3 using webrtc
Stars: ✭ 58 (-55.04%)
Mutual labels:  ionic, ionic-framework

ℹ️ Please note that this package has reached its end. After getting into the React world 2018, I lost the contact into the Angular Ecosystem. With Ionic 6, Slider.js will also be split off, which will probably make this package incompatible for now. Unfortunately I don't have the time to develop this package further according to the demands - thank you for your trust and responses, I appreciated it very much. Feel free to fork this package and work on a successor. You will find here a good tutorial how to create your own image viewer, which is based on the same approach: https://www.youtube.com/watch?v=VCUpRkRi00w

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>

Controller

Import ViewerModalComponent from ngx-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.

import { ModalController } from '@ionic/angular';
import { ViewerModalComponent } from 'ngx-ionic-image-viewer';

export class HomePage {

  constructor(public modalController: ModalController) {}

  async openViewer() {
    const modal = await this.modalController.create({
      component: ViewerModalComponent,
      componentProps: {
        src: "./assets/img/demo.jpg"
      },
      cssClass: 'ion-img-viewer',
      keyboardClose: true,
      showBackdrop: true
    });

    return await modal.present();
  }
}
<ion-button (click)="openViewer()">Open Viewer</ion-button>

Properties

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

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].