Created
July 31, 2021 13:17
-
-
Save ForceTower/e1c5d12b7f13da2bd1a61e253e26f1bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ig_media_preview(base64data) { | |
var jpegtpl = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABsaGikdKUEmJkFCLy8vQkc/Pj4/R0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0cBHSkpNCY0PygoP0c/NT9HR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR//AABEIABQAKgMBIgACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AA==", | |
t = atob(base64data), | |
p = t.slice(3).split(""), | |
o = t.substring(0, 3).split("").map(function(e) { | |
return e.charCodeAt(0) | |
}), | |
c = atob(jpegtpl).split(""); | |
c[162] = String.fromCharCode(o[1]); | |
c[160] = String.fromCharCode(o[2]); | |
return base64data ? "data:image/jpeg;base64," + btoa(c.concat(p).join("")) : null | |
}; | |
var data = "ACoqxAKmSPeeenWmZAq41uRgEjBAPPTPP+NQ2XFXZMkK44A/KmG3BDFAMqM1EI3XIQjn72OR+HvipoIWXcUIB2kcc7gf8/h1qPmaPbYpplutWfKNNiYDsTV4TDH3f1/+tW9jnIFtYx1Yn/gNas8SeUHXtgH249O1WbgxKp37QAvGcetYd3fITti6HG4+oHT8uv6VkzREDHn0+hxVgO0aHoC/yj+ZP+fWqhds9Mj1q5HPGzqkqgrjGeeDn2PT196S31Lk9NAt4smtQWw9KkSKNOgxnpwf61a3KO9dF+xztHCSzvKdzksfeos0lJWZRcglz8p69qmdhuA9Ov8AhWevWpVqbal30sdDHfsqcnPoD6f56VW+2A85b9KoKetNqrkn/9k="; | |
var uri = ig_media_preview(data); | |
document.body.insertAdjacentHTML('beforeend', '<img src="' + uri + '">'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment