What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-09 14:59:21
javascript create blob or data/image from image url
function convertImgToBase64URL(url, callback, outputFormat){ var img = new Image(); img.crossOrigin = 'Anonymous'; img.onload = function(){ var canvas = document.createElement('CANVAS'), ctx = canvas.getContext('2d'), dataURL; ... Add solution -
Javascript 2021-11-05 15:13:15
how to check if website is down javascript
function isSiteOnline(url,callback) { // try to load favicon var timer = setTimeout(function(){ // timeout after 5 seconds callback(false); },5000) var img = document.createElement("img"); img.onload = functi... Add solution -
Javascript 2021-11-02 10:19:08
array of images javascript
var imgArray = new Array(); imgArray[0] = new Image(); imgArray[0].src = 'images/img/Splash_image1.jpg'; imgArray[1] = new Image(); imgArray[1].src = 'images/img/Splash_image2.jpg'; /* ... more images ... */ imgArray[5] = new Image(); imgArray[5].src ... Add solution -
Javascript 2021-10-29 17:43:13
function resizeBase64Img(base64, newWidth, newHeight) { return new Promise<string>((resolve, reject)=>{
/** * Resize a base 64 Image * @param {String} base64 - The base64 string (must include MIME type) * @param {Number} newWidth - The width of the image in pixels * @param {Number} newHeight - The height of the image in pixels */ function resizeBase64I... Add solution -
Javascript 2021-10-18 04:32:05
javascript onmouseover change image
let img = document.querySelector('img'); let start = img.src; let hover = img.getAttribute('data-hover'); //specified in img tag img.onmouseover = () => { img.src = hover; } img.onmouseout = () => { img.src = start; } //to rever... Add solution -
Javascript 2021-10-17 05:02:05
how does URL.createObjectURl differ from fileReader
const fileSelect = document.getElementById("fileSelect"), fileElem = document.getElementById("fileElem"), fileList = document.getElementById("fileList"); fileSelect.addEventListener("click", function (e) { ... Add solution -
Javascript 2021-10-12 01:38:08
crop image javascript
Here is a function to get the image as you are uploading using the choose file button function readURL() { const myimg = document.getElementById("myimg"); const input = document.getElementById("myfile"); if(input.files &am... Add solution -
Javascript 2021-10-06 22:15:04
how to assign image to a variable in javascript
<div id="x"></div> <script> var img = document.createElement("img"); img.src = "image.png"; var src = document.getElementById("x"); src.appendChild(img); </script> Add solution