function imageLoaded()

in content/foundation/press/kit/overlays/poweredBy-overlay.js [39:87]


  function imageLoaded() {
    var poweredBys = ["poweredBy_1"];
    var poweredByXY = [[0, 0]];
    var button = [];

    imgWidth = img.width;
    imgHeight = img.height;

    aspectRatio = imgWidth / imgHeight;

    newImgWidth = imgWidth < imgHeight ? 275 : 275 * aspectRatio;
    newImgHeight = imgHeight < imgWidth ? 275 : 275 / aspectRatio;

    dstX = newImgWidth > 275 ? ((newImgWidth - 275) / 2) * -1 : 0;
    dstY = newImgHeight > 275 ? ((newImgHeight - 275) / 2) * -1 : 0;

    // draw each of the operations
    for (var n = 0; n < poweredBys.length; n++) {
      var canvas = document.getElementById("canvas_" + poweredBys[n]);
      canvas.width = 400;
      canvas.height = 400;
      var ctx = canvas.getContext("2d");
      ctx.drawImage(
        img,
        0,
        0,
        img.width,
        img.height,
        65,
        65,
        newImgWidth,
        newImgHeight
      );
      ctx.drawImage(
        poweredByImg[n],
        0,
        0,
        400,
        400,
        poweredByXY[n][0],
        poweredByXY[n][1],
        400,
        400
      );

      var dataURL = canvas.toDataURL();
      document.getElementById("img_" + poweredBys[n]).src = dataURL;
    }
  }