,'img/gold-water.png'); } else if($("#template").val() == "smoke_gold" || $("#template").val() == "smoke_red" || $("#template").val() == "smoke_silver"){ $('#maxsize').val(43); } if($("#template").val() == "smoke_gold" || $("#template").val() == "smoke_silver"){ $(".smoke-section .quote-iner > .frame-img > figure > img").addClass('grayscale_img'); } else{ $(".smoke-section .quote-iner > .frame-img > figure > img").removeClass('grayscale_img'); } $("#imgFileName,#dyntext,#rapper").val(""); $(".dyntextval").html(""); var mug = $('option:selected', "#rapper").attr('data-mug'); $(".smoke-section .quote-iner > .frame-img > figure > img,.quote-section .quote-iner > div > figure > img").attr('src',mug); $(".smoke-section .quote-iner > .contant-sec > figcaption > .jtextfill > h6,.quote-section .quote-iner > figcaption > h4").text(''); }) $("#rapper").on("change",function(){ var mug = $('option:selected', this).attr('data-mug'); var logo = $('option:selected', this).attr('data-logo'); var card = $('option:selected', this).attr('data-card'); $("#imgFileName").val($('option:selected', this).val()); if($("#template").val() == "golden" || $("#template").val() == "red" || $("#template").val() == "silver"){ $(".quote-section > .quote-iner > div > figure > img").attr('src',mug); $(".quote-section > .quote-iner > figcaption > h4").text($('option:selected', this).val()); } else if($("#template").val() == "smoke_gold" || $("#template").val() == "smoke_red" || $("#template").val() == "smoke_silver"){ $(".smoke-section .quote-iner > .frame-img > figure > img").attr('src',mug); $(".smoke-section .quote-iner > .contant-sec > figcaption > .jtextfill > h6").text($('option:selected', this).val()); } else{ $(".smoke-section .quote-iner > .frame-img > figure > img,.quote-section .quote-iner > div > figure > img").attr('src',mug); $(".smoke-section .quote-iner > .contant-sec > figcaption > .jtextfill > h6,.quote-section .quote-iner > figcaption > h4").text(''); } }) function update() { var size = parseInt(($('#maxsize').val() ? $('#maxsize').val() : 64) , 10); if (!isNaN(size)) { $('.dyntextval').html($('#dyntext').val().replace(/\r\n|\n|\r/g, '
')); $('.jtextfill').textfill({maxFontPixels: size}); } } var imgSource = $("#DivIdToPrint").get(0); $('#save').click(function(e) { html2canvas(imgSource).then(function(canvas) { var canvasWidth = canvas.width; // canvas width var canvasHeight = canvas.height; // canvas height var img = Canvas2Image.convertToImage(canvas, canvasWidth, canvasHeight); let type = $('#sel').val(); // image type let w = $('#imgW').val(); // image width let h = $('#imgH').val(); // image height let f = $('#imgFileName').val(); // file name w = (w === '') ? canvasWidth : w; h = (h === '') ? canvasHeight : h; Canvas2Image.saveAsImage(canvas, w, h, type, f); // save as image }); }); (); // image height let f = $('#imgFileName').val(); // file name w = (w === '') ? canvasWidth : w; h = (h === '') ? canvasHeight : h; Canvas2Image.saveAsImage(canvas, w, h, type, f); // save as image }); });