Skip to content

Gun-Vue docs v0.21.4Docs


Gun-Vue docs v0.21.4 / File / usePictureUpload

Function: usePictureUpload()

usePictureUpload(options): PictureUploadData

Process an uploaded picture by rendering in into a canvas with given size. Returns a base64 encoded image to be stored and displayed as img.src

Parameters

options: PictureUploadOptions

Returns

PictureUploadData

Example

ts
const src = ref(null)

const {state, handleUpload} = usePictureUpload({
 preserveRatio: true,
})

watch(()=>state.output, file => src.value = file.content)

Defined in

src/files/useFile.js:88

MIT