Skip to content

Instantly share code, notes, and snippets.

View xmile1's full-sized avatar
🏠
Working from home

Uyiosa Enabulele xmile1

🏠
Working from home
View GitHub Profile
@xmile1
xmile1 / resize-base64.js
Created August 1, 2020 21:00 — forked from ORESoftware/resize-base64.js
resizing an image on the front-end before sending to a server
// Using this code, we can retrieve an image from a user's filesystem, resize the image, and then upload the image
// to a server using AJAX. Because we use base64 encoding, we can just include the image data as just another string value
// in a JSON payload.
// So we can use AJAX to send the file to a server, which is convenient.
// We have one line of relevant html
// get file in the first place => <input type="file" custom-on-change="onAcqImageFileChange" class="form-control">