How feasible is it to customize the "ionic-img-viewer" npm package or replicate its image styling in Ionic 2?

I am wondering if it is possible to edit or add additional styles when my image is viewed using the "ionic-img-viewer" npm package. Alternatively, how can I apply the same styles as those on my original image tag?

For example, here is my img tag with some filter codes:

<img src="{{url}}" style="filter: brightness(130%) contrast(130%) grayscale(100%);" #imageToView>

Here are the codes for using the ionic-img-viewer npm package:

<button ion-button full clear icon-only color="" (click)="viewImg(imageToView)">
   <ion-icon name="expand"></ion-icon>
</button>

Typescript code snippet:

import { ImageViewerController } from "ionic-img-viewer";
...
constructor(public navCtrl: NavController, ..., public imageViewerCtrl: ImageViewerController)   
... 
viewImg(imageToView) {
  const viewer = this.imageViewerCtrl.create(imageToView);
  viewer.present();
}

When viewing the image with ionic-img-viewer, it displays the original image without any filters. Is there a way to apply my custom styles to the viewed image?

Please note that the ionic-img-viewer npm package can be found at [ https://www.npmjs.com/package/ionic-img-viewer ]

Answer №1

After some investigation, I managed to find the solution. By delving into the javascript files of npm located in:

..\node_modules\ionic-img-viewer\dist\umd\src\image-viewer.component.js ..\node_modules\ionic-img-viewer\dist\es2015\src\image-viewer.component.js

I then made changes to the template code based on the clues from the image provided below:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Removing an Element According to Screen Size: A Step-by-Step Guide

Currently, I am facing a dilemma with two forms that need to share the same IDs. One form is designed for mobile viewing while the other is for all other devices. Despite using media queries and display: none to toggle their visibility, both forms are stil ...

How come my label and input are showing up in my navigation bar?

For my assignment, I am designing a website layout and facing an issue where the text appears behind the navigation bar instead of below it. I have tried adjusting the margin-bottom to 50px with important tags and setting the nav bar as static. Despite tr ...

Updating the node version using the n library does not affect the npm version

I'm trying to sync my npm version with my node version, but no matter which node version I update to using the n library, the npm version remains stuck at 8.19.2. This is happening on my MAC running Monterey OS. ...

What are the precise steps to create a flawless scrolling area?

I am facing an issue with setting accurate scroll zones for my divs. Here's my ideal scroll zone location: scroll zone in red Currently, I have a maximum of 4 divs and each div should contain a total of 10 rectangles per category (concentration, boos ...

You need to click the form submit image twice in order to make it work

Struggling to get a standard opt-in form to work with an image submit button. The script works fine with a regular submit button, but the image button requires two clicks initially and then one click after unless the page is refreshed. I believe there mig ...

Issue encountered while generating a fresh migration in TypeORM with NestJs utilizing Typescript

I am currently working on a Node application using TypeScript and I am attempting to create a new migration following the instructions provided by TypeORM. Initially, I installed the CLI, configured my connection options as outlined here. However, when I ...

Ways to superimpose an image

Struggling to overlay an image over two div columns - I attempted using Z-index and experimented with various positioning properties. What am I missing? The triangle situated behind the two boxes, along with the additional text on JSFiddle, should appear ...

Can someone please tell me the specific HTML entity that Flickr uses for the arrow icons in the action menu?

When viewing an image on FLickr () and clicking on the Actions menu button, a pop-up menu with an arrow icon appears. Interestingly, this icon is not a simple image, but rather a combination of two characters (◢◣). Has anyone been able to determine th ...

"Exploring the Dynamic Duo of AngularJS ngAnimate and animate.css

I've been working on getting my animation to function correctly with AngularJS and animate.css. In order to achieve this, I set up the SASS in the following way: .slide-animate { &.ng-enter, &.ng-leave{ } &.ng-enter { ...

Aligning a table at the center of another table

Frustration has been brewing within me all week as I grapple with the task of sending out an important emailer soon. The challenge lies in aligning these product images next to their descriptions at the center, a feat that seems impossible to achieve withi ...

What is the correct way to create a card outline in Bootstrap?

I am currently developing a Django website to enhance my skills in coding, CSS, Html, and Bootstrap. However, I am encountering an issue with the main page of my site. The visuals on my cards do not align properly with the colored boxes at the top of the p ...

Disregard any labels when it comes to clickable areas for mouse events

Here is a simple example in JSFiddle where a text is displayed over an image inside a div element. Depending on where the cursor hovers, it can exhibit three different behaviors: pointing hand over the image, allowing text selection over the content of the ...

The css cropping issue with sprite image is not being resolved

I'm currently working on creating a sprite image for the bottom links on our media page, but I seem to be having trouble getting the image to crop correctly. Can anyone point out where I may be making a mistake? CSS .footer{ position:absolute; ...

What is causing the width discrepancy in my header section on mobile devices?

Help needed with website responsiveness issue! The site works fine on most screen sizes, but when it reaches around 414px in width, the intro section becomes too wide for the screen. Any ideas on what could be causing this problem? html: <nav id="m ...

What is preventing my CSS Animation from activating on my website?

Is there something in the code preventing the animation from working properly? .projectLinks a{ background-color: var(--secondary-color); color: var(--main-color); padding: 2px 4px 4px 4px; border-radius: 15px; margin-right: 25px; text-decorati ...

Exploring the Contrasts: ng add <package name> versus npm install <package name> in Angular 6

With the recent release of Angular6, a new command called ng add has been introduced. I am curious to know what sets this apart from the traditional npm install <package> and ng add <package>. ...

What is the version of Firebase installed in my npm package?

There seems to be a discrepancy between the versions returned by npm list firebase and firebase --version. For example, when I run: npm list firebase `-- <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7b1d12091e191a081e3b4f554 ...

Close the overlay by clicking outside of it

I'm working on creating a unique pop-up window that appears when a customer adds a product to their cart. The design features red and green background divs with a darker overlay (#overlay-daddy) and a white child div (#overlay). My issue arises from ...

What are the main challenges in resolving dependencies and implementing best practices when it comes to updating an outdated Angular NodeJS

After several months away, I am now faced with the challenge of updating and maintaining an out-of-date angular project. Seeking advice from experienced developers on how to tackle this situation. Previously, I used NPM update or upgrade commands to keep ...

Babelify is having trouble transpiling JSX code within the node_modules directory

I have successfully set up Babelify to transpile jsx code to js, and I've created node_modules before, allowing me to link them without a specific file path, just the package name. However, when I add jsx code within my node_module code, babelify flag ...