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:

https://i.sstatic.net/vEMO2.png

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

Encountering overlap issues when applying labels to my flexbox using the Spectre framework in CSS

I need help creating a "hat" with two textarea columns using the spectre.css framework. My goal is to have these columns resize based on the screen size, stacking on top of each other when the screen size is below 600px. I can achieve this without any issu ...

Is it possible to eliminate a character from text that lacks html tags or CSS classes using CSS?

I need assistance in removing characters that are not associated with any HTML tag, CSS id or class. Specifically, I want to eliminate the "--" from the provided code snippet below. Can someone please guide me on how to achieve this? <span cl ...

Positioning of the navigation menu

After customizing my Bootstrap navbar, I noticed that when the responsive size changes to mobile, the burger menu opens on the left side. Is there a way to move it to the right? Any help would be appreciated. Here is the HTML code: <!DOCTYPE html> ...

Every time I attempt to initialize a React project using the command "npx create-react-app," I encounter the error message "enoent ENOENT: no such file or directory."

I recently attempted to start a new React project and encountered the following issue: (node:4840) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase ...

Having difficulty creating a basic container

As a beginner in web development using html/css, I am eager to learn and create something simple. I want to design a responsive fixed box that always maintains a 20px distance from the viewport edges. The idea is that as the screen size changes, the box ...

I'm having trouble getting the float left to work properly in my HTML/CSS code

Currently, I am diving into the world of HTML / CSS on my own. After following some tutorials, I have taken the leap to work on my very first project. My goal is to layout three images and three text elements on a single page using CSS. The desired struct ...

"Step-by-step guide on creating a dynamic clipping mask animation triggered by mouse wheel

I have developed a sample that functions just as I envision my final outcome to function, with the exception of triggering on mouse-over. Instead, I would like it to activate as a page transition when scrolling with the mouse. (move your cursor over the i ...

Navigating Your Way Through the Center (ASP.NET MVC)

My navbar has elements that I want to center within it, but using margin hasn't been successful. Do you have any suggestions on how I can achieve this alignment using CSS? This is the code snippet: <div class="navbar "> <div class="cont ...

Using column-count within a media query is not supported

I am encountering an issue with my CSS code that includes the column-count property within a media query, and for some unknown reason, it doesn't seem to be working! .masonry { -webkit-column-count: 3; -moz-column-count: 3; column-count: ...

Setting the CSS position to fixed for a dynamically generated canvas using JavaScript

My goal is to fix the position style of the canvas using JavaScript in order to eliminate scroll bars. Interestingly, I can easily change the style using Chrome Inspector with no issues, but when it comes to implementing it through JS, I face difficulties. ...

What steps are required to generate dist/app.js from a script file in my TypeScript project?

I am currently working on a project using node, express, and TypeScript. When I run npm run build, everything builds without any issues. However, when I attempt to run npm run start, I encounter the following error: @ruler-mobility/[email protected] /User ...

Struggling to get the font-weights of the Typography and Button components in the new React with Material-UI to display

In both my previous and most recent React applications, I have the following code snippets: <Typography variant="h6" color="inherit" noWrap > h6. Heading </Typography> <Button type="button" size="large" color="primary" > ...

Proper alignment of multiple elements with Bootstrap

I am currently incorporating Bootstrap panels into my project, and I have a design mockup that looks like this: The Profile text and progress bar need to be aligned to the left, while the collapse icon should be aligned to the right. Here is the code sni ...

Setting up environment variables for node.js using NPM task: a comprehensive guide

I have a specific npm task that runs concurrently, involving node-inspector and node-supervisor. { "start": "concurrently --kill-others \"node-inspector\" \"set NODE_PATH=.&&supervisor -n error -- ./bin/www --debug\"", "prestar ...

Side-menu elevates slider

Struggling to keep my slider fixed when the side-menu slides in from the left? I've scoured for solutions without luck. Any expert out there willing to lend a hand? Code Snippet: https://jsfiddle.net/nekgunru/2/ ...

Can simply adding Bootstrap CDN make a website responsive?

Is Bootstrap truly self-sufficient when it comes to responsive design, or do custom webpages utilizing Bootstrap require additional responsive instructions? If I incorporate the Bootstrap CDN and utilize its built-in components, can I assume the webpage ...

The issue of transform scale not functioning properly in conjunction with background clip and gradients in CSS

Looking to transform a div with the transform: scale(-1,1) property while using background-clip: text on the text within it. However, this causes the text to disappear. Here's what I've attempted: .reverse { transform: scale(-1, 1); } .gr ...

The React sidebar expanded to cover the entire screen width

As I work on creating a dashboard page that will display a sidebar after the user logs in, I am facing an issue where the sidebar is taking up the full width of the page, causing my Dashboard component to drop to the bottom. You can view the image link of ...

What is the process of running npm in action?

What is the process when I enter npm run <command>? Does the <command> get executed in the sh shell, like: sh -c <command> Are there additional local variables that are added to the shell, such as a path to the node_modules/.bin directo ...

Using JavaScript to store CSS style properties in an array

In the midst of building a React-datagrid project, I am streamlining CSS properties for an array. However, there seems to be redundant CSS properties that I would like to consolidate into an array format. let _columns = []; let commonStyle = {"width":"20 ...