https://twitter.com/AlexAlexandrius/status/16178852870484254... So, all I've learned is that ChatGPT knows the obfuscated and de-obfuscated versions of code that it itself has generated.
My original code:
function resizeImage(img) {
var maxHeight = 350;
var ratio = 1;
if(img.height > maxHeight) {
ratio = maxHeight / img.height;
}
var width = img.width * ratio
var height = img.height * ratio;
var canvas = document.createElement('canvas');
canvas.height = height;
canvas.width = width;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0, width, height);
return canvas.toDataURL("image/jpeg", 0.8);
}
ChatGPT's answer:
https://i.imgur.com/5jgPMEd.png