Like the title already shows, i want to preview an IMAGE on my page —> BEFORE-UPLOAD ← on my page.
I know how to achieve this → by using the HTML-Component, but i can’t find a way of how to use for example Node-FS (File-System) to get it to work.
What do i need to know about FS ???
- Works only on Backend (checked) !!!
- Don’t have to install any NPM, because already included (checked),
- Am i able to open directly a FILE (for example an ordinary TXT-File) on my computer, without first have to upload the TXT-File???
- If there is no ability to open a Blob-Window directly, how to proceed else (workaround) ?
- What would be the right PSEUDO-CODE-CONSTRUCT to use FS ???
- How would look like a working —> PATH ?
a) → c:/xxxx/yyyyy/zzzzz/text.txt <— ? (opening from local machine possible)
b) → https://www.zzzzzzz.com/…/text.txt ???
- What else do i need to know, to be able to use FS the right way?
Example???
import fs from'fs';
let PATH = "??????????????";
let dataBuffer = fsExtra.readFileSync(PATH);
Ok, to be more precise…
I need the base64-code of an IMAGE before it gets uploaded.
How do i achieve my aim (by not using either an html-component, nor a custom-element) ?
- I am able to achieve my wished functionality → by using a html-component.
- I am able to achieve the same functionality → by using a custom-element.
- But how to generate such a function → but not using the both at all?
I want to extract the base-64-code of an image before it gets uploaded.
That means directly after selecting an image inside a BLOB (File-System).
Do i mix something up ???
Ok, i will reply to my own post .
Ok, Velo-Ninja has found his solution.
At least i was not able to work without using (either a custom-element or an html-component) .
But at the end i don’t have first to upload the image with the upload-button to my Wix-File-Manager, just to have the possibility to preview the picture —> sorry when i tell this, but → what a bullshit? <— .
Imagine that i have a app which handles with 1000 of pictures which has a preview for the pics i am getting from my loacal PC → do i have to upload all that pics → just to be able to preview them ???
!!! NO → SURELY → NOT !!!
Why do the → UPLOAD-BUTTON <— not provide base64-Data before uploading the image file ? to be able to generate a image-preview ?
However, this issue was again resolved by using an HTM-Component.
Working stable & fast.
But still my question: → Is it possible to use → fs.readFileSync(PATH), or fsExtra.readFileSync(PATH); ← in my case to be able to generate the same PREVIEW-FUNCTIONALITY but avoiding the usage of an HTML-Component or Custom-Element?
Or do i have a leck of knowledge in this case?
Getting some ideas appreciated though.
Almost a YEAR → and no answers xD, hmmmm.