1.3.0 • Published 6 years ago

react-image-resizer v1.3.0

Weekly downloads
337
License
MIT
Repository
github
Last release
6 years ago

react-image-resizer

Build Status npm version

react-image-resizer is a React component that resizes the image to be nice.

Installation

# use npm
$ npm install -D react-image-resizer

# use yarn
$ yarn add -D react-image-resizer

Usage

import React from 'react';
import Image from 'react-image-resizer';

class App extends React.Component {
  render() {
    return (
      <div>
        <Image
          src="path/to/image.jpg"
          height={ /*resize height*/ }
          width={ /*resize width*/ }
        />
      </div>
    );
  }
}

Examples

<Image
  src="path/to/image.jpg"
  width={240}
  height={240}
  style={style.image}
/>
const style = {
  image: {
    border: '1px solid #ccc',
    background: '#fefefe',
  },
};
Horizontally long caseVertically long casedisable image
HorizontallyVerticallynoimage

Options

namerequiredtypedefaultdescription
srctrueStringPath to your image
altfalseStringImage description
heighttrueNumber0Height after resize (px only)
widthtrueNumber0Width after resize (px only)
stylefalseobjectWrapper style of image
noImageSrcfalseStringPath when image could not be acquired
noImageAltfalseString'noimage'description when image could not be acquired

License

MIT

1.3.0

6 years ago

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago