Gathering detailed insights and metrics for vue-image-upload-resize
Gathering detailed insights and metrics for vue-image-upload-resize
Gathering detailed insights and metrics for vue-image-upload-resize
Gathering detailed insights and metrics for vue-image-upload-resize
@zakerxa/vue-multiple-image-upload
This is Vue Multiple Image Upload with Preview, Resize, Remove, Add More, Drag & Drop features are included.
vuetify-image-upload-resize
Vuetify restyled version of vue-image-upload-resize by Svale Fossåskaret <svale@3by5.no>
i-image-upload
vue picture component. Resize and preview your uploaded image
A simple vue-component for client-side image upload with resizing
npm install vue-image-upload-resize
Typescript
Module System
JavaScript (56.52%)
Vue (39.68%)
HTML (3.8%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
174 Stars
151 Commits
54 Forks
5 Watchers
29 Branches
6 Contributors
Updated on Jan 21, 2025
Latest Version
2.3.0
Package Id
vue-image-upload-resize@2.3.0
Size
117.38 kB
Published on
Jan 27, 2020
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A Vue.js Plugin Component for client-side image upload with optional resizing and exif-based autorotate.
This plugin was created for the use in a webapp scenario where we had a large number of end users uploading camera photos from their mobile devices on partly low end data plans. The primary purpose is therefor client-side resizing and if needed exif-based auto-rotation. It can however also be use simply as a file upload component.
Based on [ImageUploader] (https://github.com/rossturner/HTML5-ImageUploader) by Ross Turner. The plugin makes use of an optional dependency JavaScript Canvas to Blob (for blob output).
1yarn add vue-image-upload-resize
1npm install --save vue-image-upload-resize
In script entry point
1import ImageUploader from 'vue-image-upload-resize' 2Vue.use(ImageUploader);
In component
1import ImageUploader from 'vue-image-upload-resize' 2export default { 3 components: { 4 ImageUploader 5 }, 6 // ... 7}
Currently the componenet is tied to the window
object, so it can't be server side rendered.
To get around this you need to install the componenet as a client side plugin.
plugins/vue-image-upload.js
, and add the following code:1import Vue from 'vue' 2import ImageUploader from 'vue-image-upload-resize' 3 4Vue.use(ImageUploader)
nuxt.config.js
, add the client plugin:1export default { 2 // ... other config 3 plugins: [ 4 { src: '~/plugins/vue-image-upload.js', mode: 'client' }, 5 ] 6}
<client-only>
tags (<no-ssr>
in v < 2.9.0, docs).1<template> 2 <client-only> 3 <image-uploader 4 :debug="1" 5 ></image-uploader> 6 </client-only> 7</template>
1<script src="https://unpkg.com/vue-image-upload-resize"></script>
The global script automatically registers as a global componenet. See public/demo.html for example use.
1<template> 2 <image-uploader 3 :debug="1" 4 :maxWidth="512" 5 :quality="0.7" 6 :autoRotate=true 7 outputFormat="verbose" 8 :preview=false 9 :className="['fileinput', { 'fileinput--loaded' : hasImage }]" 10 :capture="false" 11 accept="video/*,image/*" 12 doNotResize="['gif', 'svg']" 13 @input="setImage" 14 @onUpload="startImageResize" 15 @onComplete="endImageResize" 16 ></image-uploader> 17</template>
An optional label tag can be added as a slot
1<image-uploader ... > 2 <label for="fileInput" slot="upload-label"> 3 <figure> 4 <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"> 5 <path class="path1" d="M9.5 19c0 3.59 2.91 6.5 6.5 6.5s6.5-2.91 6.5-6.5-2.91-6.5-6.5-6.5-6.5 2.91-6.5 6.5zM30 8h-7c-0.5-2-1-4-3-4h-8c-2 0-2.5 2-3 4h-7c-1.1 0-2 0.9-2 2v18c0 1.1 0.9 2 2 2h28c1.1 0 2-0.9 2-2v-18c0-1.1-0.9-2-2-2zM16 27.875c-4.902 0-8.875-3.973-8.875-8.875s3.973-8.875 8.875-8.875c4.902 0 8.875 3.973 8.875 8.875s-3.973 8.875-8.875 8.875zM30 14h-4v-2h4v2z"></path> 6 </svg> 7 </figure> 8 <span class="upload-caption">{{ hasImage ? 'Replace' : 'Upload' }}</span> 9 </label> 10 </image-uploader> 11
The ID for the file input, required if more than one instance should be used on the same page.
An integer in pixels for the maximum width allowed for uploaded images, selected images with a greater width than this value will be scaled down.
An integer in pixels for the maximum height allowed for uploaded images, selected images with a greater height than this value will be scaled down.
NB Is broken, see https://github.com/rossturner/HTML5-ImageUploader/issues/13. A float value in megapixels (MP) for the maximum overall size of the image allowed for uploaded images, selected images with a greater size than this value will be scaled down before upload. If the value is null or is not specified, then maximum size restriction is not applied
A float between 0 and 1.00 for the image quality to use in the resulting image data, around 0.9 is recommended.
Allows scaling down to a specified fraction of the original size. (Example: a value of 0.5 will reduce the size by half.) Accepts a decimal value between 0 and 1.
A boolean flag, if true then EXIF information from the image is parsed and the image is rotated correctly before upload. If false, then no processing is performed, and unwanted image flipping can happen. This functionality is based on the library [exif-js] https://github.com/exif-js/exif-js.
A boolean flag to toogle an img-tag displaying the uploaded image. When set to false no img-tag is displayed.
Sets the desired format for the returned image. Available formats are
null
if not available).Sets the desired class name for the input element
Sets an optional capture attribute (camera, user, environment) to the input element (only for mobile devices). The "camera" value let's the browser decide which camera to use, while the "user" and "environment" values tell the browser to prefer the front and rear cameras, respectively. To also access the device gallery capture must be set to 'false'
Specifies the types of files that can be submitted through the file upload. The types can be valid file extension starting with the STOP character (e.g: ".gif, .jpg, .png") or wildcare file types (e.g. audio/, video/, image/*"). To specify more than one value, separate the values with a comma
Specifies filetypes that will not be resized. Accepts an array of image's extension. If only 1 extension, it can be provided directly as a string.
How much to write to the console. 0 = silent. 1 = quiet. 2 = loud
Returns the processed image in requested outputformat. From this event you can add optional hooks.
1 <image-uploader @input="setImage"></image-uploader>
1 methods: { 2 setImage: function (file) { 3 this.hasImage = true 4 this.image = file 5 } 6 } 7
On start of upload.
On end of upload.
If outformat="blob"
the required libraby canvas-to-blob.min.js must be available. If the plugin is loaded with <script>
-tag in global scope, so must the relevant lilbrary:
1<script src="js/canvas-to-blob.min.js" async defer></script>
If loaded as module, npm handles all dependecies.
yarn install
yarn run serve
yarn run build
yarn run build-lib
yarn run test
yarn run lint
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/14 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
124 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More