# @pearlbea/better-img-polymer

> A simple element that adds a fallback url and logging function to an image.

Latest version **1.7.9** (published 2018-08-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @pearlbea/better-img-polymer
pnpm add @pearlbea/better-img-polymer
yarn add @pearlbea/better-img-polymer
bun add @pearlbea/better-img-polymer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.7.9 |
| Published | 2018-08-02 |
| First published | 2018-05-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 57.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | pearlbea@gmail.com |
| Maintainers | pearlbea |
| Keywords | web-component, image, web-component-tester |

## Links

- npm: https://www.npmjs.com/package/@pearlbea/better-img-polymer
- npm.io page: https://npm.io/package/@pearlbea/better-img-polymer

## Dependencies (1)

- [@polymer/polymer](https://npm.io/package/@polymer/polymer.md) ^3.0.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.7.9 (latest) — 2018-08-02
- 1.7.8 — 2018-08-01
- 1.7.7 — 2018-08-01
- 1.7.4 — 2018-07-09
- 1.7.3 — 2018-07-09
- 1.7.0 — 2018-06-28
- 1.5.4 — 2018-06-28
- 1.5.1 — 2018-06-17
- 1.6.0 — 2018-06-16
- 1.5.0 — 2018-06-08
- 1.4.6 — 2018-06-06
- 1.4.5 — 2018-06-06
- 1.4.4 — 2018-06-06
- 1.4.3 — 2018-06-06
- 1.4.2 — 2018-06-06
- … 4 more at https://npm.io/package/@pearlbea/better-img-polymer/versions

## README

# better-img-polymer

A simple Polymer element that adds a fallback url and logging function to an image.

## Installation

Install the [npm package](https://www.npmjs.com/package/@pearlbea/better-img-pollymer) or add the script from [unkpg](https://unpkg.com/@pearlbea/better-img-polymer@1.4.2/dist/bundle.js) to your HTML page.

Example:

```html
<!-- load the element from unkpg -->
<script src="https://unpkg.com/@pearlbea/better-img-polymer@1.4.2/dist/bundle.js"></script>

<!-- or from node modules -->
<script src="../node_modules/@pearlbea/better-img-polymer/better-img-polymer.js"></script>

<!-- use the component on your page -->
<better-img-polymer
  url="https://placeimg.com/480/640/animals"
  fallback="https://lorempixel.com/480/640"
  alt="an adorable animal">
</better-img-polymer>
```

## Usage

| property       | type   | default | description                                                                                                                       |
| -------------- | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------- |
| url (required) | string | null    | An image url. This will become the image's "src" attribute.                                                                       |
| fallback       | string | null    | An image url. If the url provided returns an error, the fallback url will be assigned to the "src" attribute.                     |
| width          | number | 480     | Image width                                                                                                                       |
| height         | number | 640     | Image height                                                                                                                      |
| alt            | string | ""      | Image alt text                                                                                                                    |
| log            | string | null    | If you provide the name of a function, it will be called if the url returns an error and receive the error object as a parameter. |

## Viewing your component

```
$ npm run serve
```

## Running the tests

As of this writing, Polymer tests were not working with Node 10. See the [issue on GitHub](https://github.com/Polymer/tools/issues/280).

```
$ npm test
```

---
_Source: https://npm.io/package/@pearlbea/better-img-polymer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
