New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

v-cloudinary-upload

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v-cloudinary-upload

Simple wrapper to upload files using cloudinary api ## Usage ### Locally ```js import VCloudinaryUpload from 'v-cloudinary-upload'

latest
npmnpm
Version
0.1.4
Version published
Maintainers
1
Created
Source

Vue Cloudinary Upload

Simple wrapper to upload files using cloudinary api

Usage

Locally

import VCloudinaryUpload from 'v-cloudinary-upload'

export default {
  components: { VCloudinaryUpload }
}

Globally

import Vue from 'vue'
import * as VCloudinaryUpload from 'v-cloudinary-upload'

Vue.use(VCloudinaryUpload)

Examples

Unsigned upload

<v-cloudinary-upload autoUpload accountName="skyatura" preset="foo">
	<button>Click here to select a file</button>
</v-cloudinary-upload>

Unsigned upload with preview

<v-cloudinary-upload autoUpload accountName="skyatura" preset="foo">
	<template slot-scope="props">
		<img :src="props.url" v-if="props.url">
		<button v-else>Click here to select a file</button>
	</template>
</v-cloudinary-upload>

Signed upload

<template>
	<v-cloudinary-upload ref="img" accountName="skyatura" @picked="onPickFile">
		<button>Click here to select a file</button>
	</v-cloudinary-upload>
</template>

<script>
export default {
	methods: {
		async onPickFile() {
			const params = await this.$axios.$get('/upload/userPicture')
			this.$refs.img.upload(params)
		}
	}
}
</script>

Properties

PropertyRequiredTypeDescription
accountNametrueStringYour Cloudinary's account name
autoUploadfalseBooleanIf the component should automatically perform an upload after selecting a file
capturefalseBoolean, StringPassed to the input element. Check this documentation for more details
disabledfalseBooleanIf true, the file picker won't be triggered
fileTypesfalseArray, StringA list of allowed image types. It can be either an array or comma separated. Default: *
presetfalseStringUsed when uploading unsigned pictures. It will be automatically appended to the upload request
tagfalseStringDefines the component wrapper tag. Default: div
uploadParamsfalseObjectAppend extra parameters to the upload request
@picked--EventFired when user chooses a file. It contains: file, name and url (Seeabove for more information)
@uploaded--EventFired after a successful. It contains the response from Cloudinary

Slot scope

PropertyTypeDescription
fileObjectContains the file that will be uploaded
fileReaderObjectContains the result from the file reader
nameStringThe name of the file selected, if available
urlStringThe file encoded in base64 for using in previews
loadingBooleanTrue if the component is currently uploading an image
uploadedObjectThe response from Cloudinary, if available. (Same as the passed to the uploaded event)

FAQs

Package last updated on 06 Feb 2019

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