0.0.47 • Published 5 years ago

vue-pony-uploader v0.0.47

Weekly downloads
2
License
-
Repository
github
Last release
5 years ago

vue-pony-uploader

Pony uploader is a simple drag & drop image uploader which will send image directly to Amazon S3 or Google Cloud Storage using a signed url, based on your configuration.

This project contains a server component which will work well with express, a client side component, and a full example project. Pony-uploader uses several HTML5 features and will probably not work on older browsers.

What is a signed URL?

"A signed URL is a URL that provides limited permission and time to make a request. Signed URLs contain authentication information in their query string, allowing users without credentials to perform specific actions on a resource. When you generate a signed URL, you specify a user or service account which must have sufficient permission to make the request that the signed URL will make. After you generate a signed URL, anyone who possesses it can use the signed URL to perform specified actions, such as reading an object, within a specified period of time." - Google

  • Google Cloud Storage
  • Amazon S3

Getting Started

Follow the steps below to quickly have the image loader component running within your Vue application.

Install

npm i vue-pony-uploader --save

Usage

If you have a staging and production environment for your api endpoints, consider using an environment variable for the base-url as shown below.

<!-- component.vue -->
<vue-image-upload
	v-model="image"
	ref="uploader"
	placeholder-image-url=""
	:base-url="`${VUE_APP_PONY_UPLOADER_HOST}`"
></vue-image-upload>
// component.js
import VueImageUpload from 'vue-pony-uploader'
Vue.component('vue-image-upload', VueImageUpload)

const vue = new Vue({
  el: '#app',
  components: { App },
  template: '<App/>'
})
export { vue as Vue }

Options

Since the component provides the ability to optionally track image metadata with a backend of your choice, there are many options available.

keytypedefaultrequired
base-urlStringN/AYes
signature-urlString/signatureNo
index-urlString/indexNo
bucketStringimagesNo
track-image-statusBooleanfalseNo
widthNumber200No
heightNumber200No
imageWidthNumber200No
imageHeightNumber200No
jpgQualityNumber1No
imageBackgroundColorString#9ffNo

Setup and Run Demo

Follow the steps below to have the example Vue application and example server up and running quickly.

Setup Amazon S3 or Google Cloud Storage

NOTE: The example server is meant to be an example and should not be considered production ready. The /signature endpoint will fetch a signed url once you have provided your cloud credentials. However, the /index endpoints for optional image tracking is only stubbed out. It is up to you to implement them should you want to track whether the image ends up getting used or will become stale.

Details on setting up your server can be found here

NOTE: The example server provides the functionality for obtaining a signed url from Amazon S3 or Google provided only has the index endpoints stubbed out. It is up to you to implement them should you want to track whether the image ends up getting used or will become stale.

Run with Docker

$ git clone https://github.com/ponycode/pony-uploader
$ cd pony-uploader/example
$ docker-compose up

Navigate to http://localhost:3001

Run without Docker

$ git clone https://github.com/ponycode/pony-uploader
$ cd pony-uploader/example/server
$ npm install
$ npm start
$ cd .. && cd client-demo
$ npm install
$ npm run serve 

Navigate to http://localhost:8080

License

Copyright (c) 2015 Joshua Kennedy Licensed under the MIT license.

0.0.47

5 years ago

0.0.46

5 years ago

0.0.45

5 years ago

0.0.44

5 years ago

0.0.43

5 years ago

0.0.41

5 years ago

0.0.40

5 years ago

0.0.39

5 years ago

0.0.38

5 years ago

0.0.37

5 years ago

0.0.36

5 years ago

0.0.35

5 years ago

0.0.34

5 years ago

0.0.32

5 years ago

0.0.31

5 years ago

0.0.30

5 years ago

0.0.29

5 years ago

0.0.28

5 years ago

0.0.27

5 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago