All Projects → jofftiquez → V Img Fallback

jofftiquez / V Img Fallback

Licence: mit
Vue Image Fallback

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to V Img Fallback

Blurhash Rust Wasm
A Rust and WASM implementation of the blurhash algorithm
Stars: ✭ 119 (+176.74%)
Mutual labels:  image, placeholder
Sqip
"SQIP" (pronounced \skwɪb\ like the non-magical folk of magical descent) is a SVG-based LQIP technique.
Stars: ✭ 3,074 (+7048.84%)
Mutual labels:  image, placeholder
React Native Blurhash
🖼️ A library to show colorful blurry placeholders while your content loads.
Stars: ✭ 430 (+900%)
Mutual labels:  image, placeholder
Hard Aware Deeply Cascaed Embedding
source code for the paper "Hard-Aware-Deeply-Cascaed-Embedding"
Stars: ✭ 32 (-25.58%)
Mutual labels:  image
Vue Esc
🏃 Vue.js directive to add a document event listener on escape keyup.
Stars: ✭ 33 (-23.26%)
Mutual labels:  vue-directive
React Shimmer
🌠 Async loading, performant Image component for React.js
Stars: ✭ 990 (+2202.33%)
Mutual labels:  placeholder
Aimage
An animated gif & apng engine for iOS in Swift. Have a great performance on memory and cpu usage.
Stars: ✭ 1,014 (+2258.14%)
Mutual labels:  image
React Image Lightbox
React lightbox component
Stars: ✭ 956 (+2123.26%)
Mutual labels:  image
Cv Pretrained Model
A collection of computer vision pre-trained models.
Stars: ✭ 995 (+2213.95%)
Mutual labels:  image
React Responsive Image
🖼️ A React responsive image component.
Stars: ✭ 36 (-16.28%)
Mutual labels:  image
Pywebp
Python bindings for WebP
Stars: ✭ 35 (-18.6%)
Mutual labels:  image
Photobrowser
Elegant photo browser in Swift. 图片与视频浏览器。
Stars: ✭ 975 (+2167.44%)
Mutual labels:  image
Mdcs Py
MDCS is an acronym for Mosaic Dataset Configuration Script and is the entry point to a collection of Python classes/libraries that could be consumed by a Python client application to complete a given workflow for creating a mosaic dataset, populating it with data, and setting all required/desired parameters.
Stars: ✭ 38 (-11.63%)
Mutual labels:  image
Rverify.js
✅❎ A lightweight image rotation verification plugin.
Stars: ✭ 33 (-23.26%)
Mutual labels:  image
Navscroll Js
Lightweight package for highlighting menu items as you scroll the page, also scrolling to target section when item clicked. Use as a vue component/directive or in vanilla js.
Stars: ✭ 41 (-4.65%)
Mutual labels:  vue-directive
React Grid Carousel
React responsive carousel component w/ grid layout
Stars: ✭ 29 (-32.56%)
Mutual labels:  image
Inputaccessoryview
Input Accessory View for Commenting and Chat User Interfaces built in Swift, if you like it please "☆"
Stars: ✭ 39 (-9.3%)
Mutual labels:  placeholder
Kirby Autofocus
Content aware image cropping for Kirby. Kirby 2 and 3.
Stars: ✭ 35 (-18.6%)
Mutual labels:  image
Superplaceholder.js
⚡Super charge your input placeholders
Stars: ✭ 978 (+2174.42%)
Mutual labels:  placeholder
Imagemin Module
Automatically optimize (compress) all images used in Nuxt.js
Stars: ✭ 37 (-13.95%)
Mutual labels:  image

Vue Image Fallback

v-img-fallback

Vue image placeholder directive for broken images.

If you like this project, please give it a star, and consider following the author. :)

Usage

Install with NPM or Yarn

npm install v-img-fallback --save

yarn add v-img-fallback

Transpile for target: es5

This module is distributed as an esm module.

If you need backwards compatibility, you will need to transpile this module:

// in your vue.config.js for vue-cli-3
module.exports = {
  /* ... other config ... */
  transpileDependencies: ['v-img-fallback']
}

Install globally

import Vue from 'vue';
import VueImgFallback from 'v-img-fallback';

Vue.use(VueImgFallback, {
  loading: 'path/to/loading/image',
  error: 'path/to/error/image'
});

Install locally

<template>
  <img src="foo.png" v-img-fallback="imgFallback">
</template>

<script>
import { ImgFallback } from 'v-img-fallback';

export default {
  directives: {
    ImgFallback
  },
  data: () => {
    imgFallback: {
      loading: 'path/to/loading/image',
      error: 'path/to/error/image'
    }
  }
};
</script>

API

This directive can receive string or object value.

string

Path or image url. This value will be used in both loading and error state.

object

{
  loading: 'path/to/loading/image',
  error: 'path/to/error/image'
}

Sample - pass a string

<template>
  <img src="foo.png" v-img-fallback="path/to/placeholder">
</template>

Sample - pass an object

<template>
  <img src="foo.png" v-img-fallback="imgFallback">
</template>

<script>
  export default {
    data: () => {
      imgFallback: {
        loading: 'path/to/loading/image',
        error: 'path/to/error/image'
      }
    }
  }
</script>

Update

January 25, 2018 - Added options object to Vue.use(VueImgFallback, options). Options should have loading and error properties. These values will always be overwritten by the value inside v-img-fallback directive.

Tips

loading value can be a .gif Gee. Ahy. Ef. (I will die with dignity LOL).

Made with ❤️ by Jofferson Ramirez Tiquez

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