Skip to content

Instantly share code, notes, and snippets.

View TaiwoAkinnusoye's full-sized avatar

Taiwo Akinnusoye TaiwoAkinnusoye

View GitHub Profile
@rafaelverger
rafaelverger / takess.js
Last active February 11, 2020 18:27
Taking screenshot of full document body using html2canvas and uploading to cloudinary
function takeSS(cloudinary_name, cloudinary_key, cloudinary_unsigned_preset, main_element){
main_element = main_element || document.body;
const imageUrlToBase64 = (url) => fetch(
`https://get-base64-image.rafaelverger.now.sh/?url=${encodeURIComponent(url)}`
).then(res => res.text());
const _takeSS = () => {
const elementImages = [].slice.call(
main_element.querySelectorAll('img'), 0
).filter(img => /^http/.test(img.src));