123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /**
- *
- * @authors Eric Hsiao
- *
- */
-
- main = function () {
-
- //private menbers
- var templateData;
- var templateData2;
- var photoData;
-
- //private methods
- function init() {
- console.log('main is loaded.');
-
- var userphotoHelper = new photoHelper();
- $('.plotoUpLoad__btn').change(function (e) {
- e.preventDefault();
-
- userphotoHelper.loadFile('.plotoUpLoad__btn',function (_photoData) {
- console.log('Photo has loaded.');
- photoData = _photoData;
- $('.output').attr('src', photoData);
- });
- });
-
-
- var templeteHelper = new photoHelper();
- $('.templeteUpLoad__btn').change(function (e) {
- e.preventDefault();
-
- templeteHelper.loadFile('.templeteUpLoad__btn',function (_photoData) {
- console.log('templete has loaded.');
- templateData = _photoData;
- $('.templete_output').attr('src', templateData);
- });
- });
-
-
- $('.faceFusion__start').click(function (e) {
- e.preventDefault();
- var _faceFusionAlpha = $('.faceFusion__alpha').val();
- // var _templateURL = 'https://ncxpre.cecmartech.com/main/%5BEric%5DphotoHelper/images/demo2.jpg';
-
- //傳入 樣板URL:_templateURL 自動轉Base64
- //傳入 使用者圖片:photoData(base64)
- //傳入 融合參數:_faceFusionAlpha 預設0.49
-
- //返回 _merge_image(base64)
-
- faceFusionAPI.start(templateData, photoData, _faceFusionAlpha, function (_merge_image) {
- //_merge_image
- $('.faceFusion').attr('src', _merge_image);
- });
- });
- }
-
- //constructor
-
- {
- $(document).ready(function () {
- init();
- });
- }
-
- //public
-
- return {
-
- }
- }
-
- main = new main();
|