You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

rc-image

Package Overview
Dependencies
5
Maintainers
4
Versions
91
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-image

React easy to use image component


Version published
Maintainers
4
Created

Package description

What is rc-image?

The rc-image npm package is a React component library for displaying images in a more versatile and enhanced manner. It provides features such as modal viewing, image rotation, zooming, and dragging, making it a powerful tool for implementing image galleries or for enhancing the image viewing experience in web applications.

What are rc-image's main functionalities?

Modal Image Viewing

This feature allows images to be viewed in a modal (popup) when clicked, providing a closer look. The code sample demonstrates how to enable modal viewing with visibility control.

{"import React from 'react';\nimport Image from 'rc-image';\n\nexport default () => (\n  <Image\n    preview={{\n      visible: true,\n      onVisibleChange: (vis) => console.log('visible:', vis),\n    }}\n    src='path/to/image.jpg'\n  />\n);"}

Image Rotation

Enables the rotation of images. This example shows how to rotate an image by 90 degrees using inline styles.

{"import React from 'react';\nimport Image from 'rc-image';\n\nexport default () => (\n  <Image\n    style={{ transform: 'rotate(90deg)' }}\n    src='path/to/image.jpg'\n  />\n);"}

Zoom and Drag

This feature allows users to zoom in/out on images and drag them around for better viewing. The code sample demonstrates enabling zoom and drag capabilities in the preview modal.

{"import React from 'react';\nimport Image from 'rc-image';\n\nexport default () => (\n  <Image\n    preview={{\n      zoomable: true,\n      draggable: true,\n    }}\n    src='path/to/image.jpg'\n  />\n);"}

Other packages similar to rc-image

Readme

Source

rc-image


React Image.

NPM version CircleCI status Test coverage Dependencies DevDependencies npm download bundle size

Feature

  • Placeholder
  • Preview
  • Rotate
  • Zoom
  • Fallback

Keyboard

install

rc-image

Usage

npm install
npm start
const Image = require('rc-image');

ReactDOM.render(
  <Image src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
), document.getElementById('root'));

API

NameTypeDefaultDescription
previewboolean | {visible: boolean,onVisibleChange:function(value, prevValue),getContainer: string | HTMLElement | (() => HTMLElement) | false }trueWhether to show preview
prefixClsstringrc-imageClassname prefix
placeholderboolean | ReactElement-if true will set default placeholder or use ReactElement set customize placeholder
fallbackstring-Load failed src
previewPrefixClsstringrc-image-previewPreview classname prefix

Example

http://localhost:8003/examples/

Test Case

npm test

Coverage

npm run coverage

License

rc-image is released under the MIT license.

Keywords

FAQs

Package last updated on 04 Nov 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc