All Projects → laurenashpole → React Inner Image Zoom

laurenashpole / React Inner Image Zoom

Licence: mit
A React component for zooming images.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Inner Image Zoom

Photo view
📸 Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.
Stars: ✭ 1,280 (+1584.21%)
Mutual labels:  images, zoom
Tileview
TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.
Stars: ✭ 1,447 (+1803.95%)
Mutual labels:  images, zoom
vue-inner-image-zoom
laurenashpole.github.io/vue-inner-image-zoom
Stars: ✭ 90 (+18.42%)
Mutual labels:  images, zoom
Images Web Crawler
This package is a complete tool for creating a large dataset of images (specially designed -but not only- for machine learning enthusiasts). It can crawl the web, download images, rename / resize / covert the images and merge folders..
Stars: ✭ 51 (-32.89%)
Mutual labels:  images
Qlimagesize
QuickLook and Spotlight plugins to display the dimensions, size and DPI of an image in the title bar instead of the filename. Also preview some unsupported formats like WebP & bpg.
Stars: ✭ 1,071 (+1309.21%)
Mutual labels:  images
Gmimagepicker.xamarin
Port of the original GMImagePicker component to Xamarin.iOS
Stars: ✭ 65 (-14.47%)
Mutual labels:  images
Photobrowser.forms
Full screen image viewer(Xamarin.Forms) that includes "pinch to zoom" and "swipe to dismiss" gestures.
Stars: ✭ 75 (-1.32%)
Mutual labels:  images
Extended image
A powerful official extension library of image, which support placeholder(loading)/ failed state, cache network, zoom pan image, photo view, slide out page, editor(crop,rotate,flip), paint custom etc.
Stars: ✭ 1,021 (+1243.42%)
Mutual labels:  zoom
Efimageviewzoom
DEPRECATED 🌃 A very simple IBDesignable UIImageView with pinch zoom swift
Stars: ✭ 71 (-6.58%)
Mutual labels:  zoom
Logisim
Logisim Italian Fork
Stars: ✭ 61 (-19.74%)
Mutual labels:  zoom
React Native Learning Resources
Collection of some good resources for react-native ✨ 🔥 💥
Stars: ✭ 61 (-19.74%)
Mutual labels:  images
Whatsapp Sticker Maker
Whatsapp android sticker maker
Stars: ✭ 54 (-28.95%)
Mutual labels:  images
Opendcx
OpenDCX Repository
Stars: ✭ 67 (-11.84%)
Mutual labels:  images
Nativescript Fresco
This repository holds the NativeScript plugin that exposes the functionality of the Fresco image library to NativeScript developers.
Stars: ✭ 51 (-32.89%)
Mutual labels:  images
Lsky Pro
☁️Lsky Pro - Your photo album on the cloud.
Stars: ✭ 1,174 (+1444.74%)
Mutual labels:  images
Derpibooru Downloader
Downloads images from derpibooru.org using a variety of options
Stars: ✭ 45 (-40.79%)
Mutual labels:  images
Picasso
Laravel Image Management and Optimization Package
Stars: ✭ 70 (-7.89%)
Mutual labels:  images
Handyview
Handy image viewer based on PyQt5. Convenient for viewing and comparing :-)
Stars: ✭ 60 (-21.05%)
Mutual labels:  zoom
Catt
Detecting the temperature from an infrared image
Stars: ✭ 60 (-21.05%)
Mutual labels:  images
Ecola
Tree editor for touch screens
Stars: ✭ 64 (-15.79%)
Mutual labels:  zoom

react-inner-image-zoom

Demos

A React component for magnifying an image within its original container. The zoom behavior is triggered on click and the image can be moved by dragging on touch devices and by either dragging or hover panning on non-touch devices. The component supports responsive images and optional fullscreen zoom on mobile.

Travis npm package

Installation

Note: Version 2.0.0 introduces React hooks and requires React v16.8.0 or above. To use this package with older versions of React, install with npm install [email protected] or yarn add [email protected] instead of the instructions below.

NPM

npm install react-inner-image-zoom

Yarn

yarn add react-inner-image-zoom

Styling

I was originally importing the CSS directly into the component but I've recently realized that makes too many assumptions about the wider build process. You can now download the raw CSS file at:

/src/InnerImageZoom/styles.css

or the minified raw minified version at:

/src/InnerImageZoom/styles.min.css

to include however you see fit. Or, if your setup supports it, import the files directory from your node_modules using:

import 'react-inner-image-zoom/lib/InnerImageZoom/styles.css';

or:

import 'react-inner-image-zoom/lib/InnerImageZoom/styles.min.css';

Usage

Import and render the component:

import InnerImageZoom from 'react-inner-image-zoom';

...

<InnerImageZoom src="/path/to/image.jpg" zoomSrc="/path/to/zoom-image.jpg" />

This is the simplest usage. For additional examples, visit the demo page.

Props

Prop Type Default Description
src String (Required) URL for the original image.
srcSet String Default srcset attribute for a responsive original image.
sizes String Default sizes attribute for use with srcset.
sources Array A list of image sources for using the picture tag to serve the appropriate original image (see below for more details).
width Number Width attribute for original image.
height Number Height attribute for original image.
hasSpacer Boolean false If true, gets the original image's aspect ratio based on the width and height props and creates a spacer to prevent cumulative layout shift.
zoomSrc String URL for the larger zoom image. Falls back to original image src if not defined.
zoomScale Number 1 Multiplied against the natural width and height of the zoomed image. This will generally be a decimal (example, 0.9 for 90%).
zoomPreload Boolean false If set to true, preloads the zoom image instead of waiting for mouseenter.
alt String Alternative text for the original image.
moveType String pan pan or drag. The user behavior for moving zoomed images on non-touch devices.
zoomType String click click or hover. The zoom behavior for images.
fadeDuration Number 150 Fade transition time in milliseconds. If zooming in on transparent images, set this to 0 for best results.
fullscreenOnMobile Boolean false Enables fullscreen zoomed image on touch devices below a specified breakpoint.
mobileBreakpoint Number 640 The maximum breakpoint for fullscreen zoom image when fullscreenOnMobile is true.
hideCloseButton Boolean false Hides the close button on touch devices. If set to true, zoom out is triggered by tap.
hideHint Boolean false Hides the magnifying glass hint.
className String Custom classname for styling the component.
afterZoomIn Function Function to be called after zoom in.
afterZoomOut Function Function to be called after zoom out.

Sources

This prop accepts an array of objects which it uses to create a picture tag and source elements. The component looks for the following optional properties and you can find additional details on responsive images here:

Prop Type Default Description
srcSet String Srcset attribute for source tag.
sizes String Sizes attribute for source tag.
media String An attribute containing a media condition for use with the srcset.
type String An image MIME type. This is useful for using newer formats like WebP.

Issues

Please submit issues or requests here.

Most of the implementation choices for this component are based on use cases I've encountered in the past. For example, I chose a click to zoom trigger because it's been the most requested on product detail pages I've worked on. If there's a demand for zoom on hover or other additional functionality, I'd be open to looking into it so feel free to ask.

If you're interested in contributing, check out the guidelines here.

License

MIT

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].