Gathering detailed insights and metrics for @akashmitra/vue-image-browser
Gathering detailed insights and metrics for @akashmitra/vue-image-browser
Gathering detailed insights and metrics for @akashmitra/vue-image-browser
Gathering detailed insights and metrics for @akashmitra/vue-image-browser
A VueJS Image Browser Component with options to upload, browse, delete and select images
npm install @akashmitra/vue-image-browser
Typescript
Module System
Node Version
NPM Version
Vue (90.74%)
JavaScript (9.26%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
13 Stars
16 Commits
9 Forks
1 Watchers
7 Branches
1 Contributors
Updated on Jan 17, 2025
Latest Version
1.2.4
Package Id
@akashmitra/vue-image-browser@1.2.4
Unpacked Size
2.64 MB
Size
2.48 MB
File Count
15
NPM Version
7.5.4
Node Version
14.12.0
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 JavaScript Image Browser written in VueJS and styled with TailwindCSS.
Install as npm package
npm install @akashmitra/vue-image-browser
import
this as a component. You may also use this inside another Vue component.
1<template> 2 3 <VueImageBrowser 4 :images="photos" 5 :image-properties="photoFields" 6 allow-upload 7 allow-delete 8 enable-lazy-load> 9 </VueImageBrowser> 10 11</template> 12<script> 13import VueImageBrowser from '@akashmitra/vue-image-browser' 14 15export default { 16 components: { 17 VueImageBrowser, 18 }, 19 data() { 20 return { 21 photos: [ 22 {'id': 1, 'name': 'sunflower.jpg', 'url': '/images/sunflower.jpg'}, 23 {'id': 2, 'name': 'rose.jpg', 'url': '/images/rose.jpg'}, 24 {'id': 3, 'name': 'tulip.jpg', 'url': '/images/tulip.jpg'}, 25 ], 26 photoFields: { 27 'id': 'Image ID', 'name': 'File Name', 'url': 'Image Location' 28 } 29 } 30 } 31} 32</script> 33
The images
attribute in VueImageBrowser
accepts an array containing one or more "image objects" with following mandatory fields - id
, name
and url
. The image object can contain other fields as well. You can specify the additional fields in image-properties
as key-value pairs, where the key
is the attribute name and the value
is the attribute title.
It is possible to upload an image to a specified API endpoint (save-url
) via POST.
When an image is uploaded successfully, a 200 HTTP Status code response must be sent back from the server with a response JSON. After the image is uploaded successfully, a saved
event will be generated and the response JSON will be passed with the event. Please see the example section below.
Parameter | Type | Default Value | Description |
---|---|---|---|
images | Array | [] | An array containing the image objects. Each image object must contain id , name and url of the image |
image-properties | Object | An object containing all the fields in image object along with the field titles | |
allow-upload | Boolean | false | (OPTIONAL) Whether or not to provide provision for image upload. If this is true , a save-url must be provided. |
save-url | String | /api/photos | Specify the URL endpoint for posting the uploaded images. |
save-request-headers | Object | {} | (OPTIONAL) If you need to pass any additional HTTP headers, you may do so by providing the header names and values in this object |
allow-photo-pane | Boolean | false | (OPTIONAL) When this attribute is true, clicking on an image in the gallery will show a larger version of the image in a Photo pane, along with any additional image information. |
allow-delete | Boolean | false | (OPTIONAL) Whether or not to provide a provision for deleting an image in Photo Pane view. If this is true, delete button will be shown and a deleted event will be generated |
allow-choose | Boolean | false | (OPTIONAL) Whether or not to provide a provision for chosing the image inside Photo Pane view. If this is true, a "Choose" button will be displayed and a chosen event will be generated |
allow-copy | Boolean | true | (OPTIONAL) Whether or not to provide a provision for copying the image URL in the Photo Pane View. If this is true, a Copy Link button will be shown and image url will be copied to clipboard |
captionable | Boolean | false | (OPTIONAL) Whether or not to provide a provision for specifying the image caption after selecting an image. If this is true, a prompt will be shown for image caption when users select an image |
enable-lazy-load | Boolean | true | (OPTIONAL) Uses IntersectionObserver to ensure the images are only loaded to browser when the image comes near the browser viewport |
search-delay | Number | 500 | (OPTIONAL) A delay in miliseconds after which the search event is fired. |
max-images-per-row | Number | 5 | (OPTIONAL) Maximum number of images to be displayed in each row in image gallery. Must be a value from 1 to 6. Actual number of displayed images will vary based on screen-size |
post-key | String | image | (OPTIONAL) The name of the post request parameter to be used while posting file to the server. |
Following events are generated when performing various interactions with the images.
Event | Parameter Type | Parameter Value | Description |
---|---|---|---|
searched | String | seach phrase | This event is generated when users search in the search box. The search phrase is passed to the event handler, which can be used to filter the images array |
selected | Object | image | This event is generated when users click on an image in the Gallery. The image is passed to the event handler. |
chosen | Object | image | This event is generated when users select an image. The image is passed to the event handler. |
saved | Object | image | This event is generated when users successfully upload an image. The image is passed to the event handler. |
deleted | Object | image | This event is generated when users delete an image. The image is passed to the event handler. |
1<template> 2 3 4 <VueImageBrowser 5 :images="photos" 6 :image-properties="imageFields" 7 allow-photo-pane 8 allow-choose 9 allow-upload 10 allow-delete 11 enable-lazy-load 12 save-url="/api/media" 13 :save-request-headers="headers" 14 @selected="onSelect" 15 @chosen="onChoose" 16 @saved="onSave" 17 @deleted="onDelete" 18 @searched="onSearch" 19 > 20 </VueImageBrowser> 21 22 23</template> 24 25<script> 26 27import VueImageBrowser from '@akashmitra/vue-image-browser' 28 29export default { 30 components: { 31 VueImageBrowser, 32 }, 33 data() { 34 return { 35 photos: [], 36 headers: { 37 "X-CSRF-Token": document.head.querySelector('meta[name="csrf-token"]').content 38 }, 39 imageFields: { 40 'id': 'File ID', 41 'name': 'Image Name', 42 'url': 'url', 43 'size': 'File Size (KB)', 44 'type': 'Image Type', 45 } 46 } 47 }, 48 49 created() { 50 this.getFromServer() 51 }, 52 53 methods: { 54 onDelete(image) { 55 // make an ajax call to server to delete the image 56 // TODO 57 // on ajax success, remove the image from your list 58 for(let i = 0; i < p.photos.length; i++) { 59 let photo = p.photos[i] 60 if (photo.id === image.id){ 61 p.photos.splice(i, 1) 62 break 63 } 64 } 65 }, 66 67 onSelect(image) { 68 console.log('on select', image) 69 }, 70 71 onSearch(query) { 72 this.getFromServer(query) 73 }, 74 75 onSave(image) { 76 this.photos.unshift(image) 77 }, 78 79 getFromServer(search_phrase) { 80 // search the images on server based on the search phrase 81 }, 82 83 } 84} 85</script> 86 87
TailwindCSS must be present for the styling.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/13 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- 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
22 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
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