{"id":9964,"date":"2021-09-09T12:19:20","date_gmt":"2021-09-09T16:19:20","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=9964"},"modified":"2021-09-09T12:24:59","modified_gmt":"2021-09-09T16:24:59","slug":"embedding-images-in-text-files","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=9964","title":{"rendered":"Embedding Images in Text Files"},"content":{"rendered":"<p>Yuan Fu likes to take notes in which he can embed images. You can do that with Org, of course, but Fu doesn\u2019t like that Org\u2019s solution boils down to a link to a file. That means you have to keep the file paths in sync. He wanted a solution that embedded the image in the file <i>and<\/i> made it easy to resize the image on the fly.<\/p>\n<p>To a first approximation, <a href=\"https:\/\/casouri.github.io\/note\/2020\/embed-images-in-text-files\/index.html\">his solution<\/a> is simple: Embed the image as a Base64 string at the bottom of the buffer and put an internal link to it at the point to where it is to appear. Of course, there are complications. First, there\u2019s handling the resizing. That\u2019s not too hard but there are also display issues such as having reasonable scrolling. Fu has some animated screenshots that show this in action. It appears to work well.<\/p>\n<p>The <a href=\"https:\/\/github.com\/casouri\/lunarymacs\/blob\/master\/site-lisp\/iimg.el\">code<\/a> does not appear to be in Melpa and Fu doesn\u2019t say whether he plans to submit it but it\u2019s a single file and should be easy to load and try out. If you have a need to permanently embed images in a file and don\u2019t want to have to worry about keeping file paths in sync, this is a good solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yuan Fu likes to take notes in which he can embed images. You can do that with Org, of course, but Fu doesn\u2019t like that Org\u2019s solution boils down to a link to a file. That means you have to &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=9964\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-9964","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9964"}],"version-history":[{"count":2,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9964\/revisions"}],"predecessor-version":[{"id":9966,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9964\/revisions\/9966"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}