{"action":"created","issue":{"url":"https://api.github.com/repos/evidenceprime/html-docx-js/issues/2","labels_url":"https://api.github.com/repos/evidenceprime/html-docx-js/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/evidenceprime/html-docx-js/issues/2/comments","events_url":"https://api.github.com/repos/evidenceprime/html-docx-js/issues/2/events","html_url":"https://github.com/evidenceprime/html-docx-js/issues/2","id":64673701,"number":2,"title":"Image support","user":{"login":"pedroteixeira","id":14740,"avatar_url":"https://avatars.githubusercontent.com/u/14740?v=3","gravatar_id":"","url":"https://api.github.com/users/pedroteixeira","html_url":"https://github.com/pedroteixeira","followers_url":"https://api.github.com/users/pedroteixeira/followers","following_url":"https://api.github.com/users/pedroteixeira/following{/other_user}","gists_url":"https://api.github.com/users/pedroteixeira/gists{/gist_id}","starred_url":"https://api.github.com/users/pedroteixeira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedroteixeira/subscriptions","organizations_url":"https://api.github.com/users/pedroteixeira/orgs","repos_url":"https://api.github.com/users/pedroteixeira/repos","events_url":"https://api.github.com/users/pedroteixeira/events{/privacy}","received_events_url":"https://api.github.com/users/pedroteixeira/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-27T01:57:51Z","updated_at":"2015-03-27T20:06:57Z","closed_at":null,"body":"I just realized that docx that does not supported embed data url in <img src>. Do you have any ideas for this?\r\n\r\nWas looking in a way to add imagens in the zip and reference them.. but seems tricky.\r\n(I've done saving images in the zip, but not sure how to alter the altchunk)\r\n\r\nthanks."},"comment":{"url":"https://api.github.com/repos/evidenceprime/html-docx-js/issues/comments/87074316","html_url":"https://github.com/evidenceprime/html-docx-js/issues/2#issuecomment-87074316","issue_url":"https://api.github.com/repos/evidenceprime/html-docx-js/issues/2","id":87074316,"user":{"login":"pedroteixeira","id":14740,"avatar_url":"https://avatars.githubusercontent.com/u/14740?v=3","gravatar_id":"","url":"https://api.github.com/users/pedroteixeira","html_url":"https://github.com/pedroteixeira","followers_url":"https://api.github.com/users/pedroteixeira/followers","following_url":"https://api.github.com/users/pedroteixeira/following{/other_user}","gists_url":"https://api.github.com/users/pedroteixeira/gists{/gist_id}","starred_url":"https://api.github.com/users/pedroteixeira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedroteixeira/subscriptions","organizations_url":"https://api.github.com/users/pedroteixeira/orgs","repos_url":"https://api.github.com/users/pedroteixeira/repos","events_url":"https://api.github.com/users/pedroteixeira/events{/privacy}","received_events_url":"https://api.github.com/users/pedroteixeira/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T20:06:57Z","updated_at":"2015-03-27T20:06:57Z","body":"We can save the images into the zip, using something like:\r\n```\r\n   var imgRE = /src=\"?([^\"\\s]+)\"?\\s*/g;   \r\n   var canvas = document.createElement('canvas');\r\n    var context = canvas.getContext('2d');\r\n\r\n    while ( m = imgRE.exec( html ) ) {\r\n      var url = m[1];\r\n      if(url in images) {\r\n        continue;\r\n      }\r\n\r\n      var image = new Image();\r\n      image.src = url;\r\n      context.drawImage(image, 0, 0);\r\n      images[url] = canvas.toDataURL(\"image/png\");\r\n    }\r\n\r\n    Object.keys(images).forEach(function(url) {\r\n      html = html.replace(new RegExp('src=\"'+url+'\"','g'), 'src=\"' + images[url] + '\"');\r\n    });\r\n```\r\n\r\nBut after it seems a bit tricky.. because I would had to split the html into multiple Altchunks and create Word ML for each image. But it would be really cool to be able to solve it.\r\n\r\n\r\n\r\n"}}