{"id":8744,"date":"2019-07-03T08:55:15","date_gmt":"2019-07-03T08:55:15","guid":{"rendered":"https:\/\/www.webhozz.com\/blog\/?p=8744"},"modified":"2019-07-16T10:37:59","modified_gmt":"2019-07-16T10:37:59","slug":"konversi-gambar-ke-base64-dengan-jquery","status":"publish","type":"post","link":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/","title":{"rendered":"Konversi Gambar ke Base64 dengan jQuery"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Menurut wikipedia,  Base64 adalah sekelompok skema pengkodean biner-ke-teks yang mewakili data biner dalam format string ASCII dengan menerjemahkannya ke dalam representasi radix-64. Wahh ribet ya ? \ud83d\ude42<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Versi sederhananya adalah kumpulan karakter atau string. Gambar juga bisa dikonversi menjadi kumpulan string base64. Dengan Base64, gambar yang di-load oleh website akan sangat ringan, karena website seperti memanggil text saja.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Berikut ini adalah contoh kode Konversi Gambar menjadi Base64 dengan menggunakan jQuery<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n\t&lt;title&gt;How to convert image into base64 string jQuery?&lt;\/title&gt;\n\t&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jquery\/3.2.1\/jquery.min.js&quot;&gt;&lt;\/script&gt;\n&lt;\/head&gt;\n\n&lt;body&gt;\n\n&lt;form&gt;\n\t&lt;input type=&quot;file&quot; name=&quot;image&quot; onchange=&quot;encodeImagetoBase64(this)&quot;&gt;\n\t&lt;p class=&quot;hasil&quot;&gt;&lt;\/p&gt;\n&lt;\/form&gt;\n\n&lt;script type=&quot;text\/javascript&quot;&gt;\n\n   function encodeImagetoBase64(element) {\n\t  var file = element.files&#x5B;0];\n\t  var reader = new FileReader();\n\t  reader.onloadend = function() {\n              $(&quot;.hasil&quot;).text(reader.result);\n\t  }\n\t  reader.readAsDataURL(file);\n\n\t}\n\n&lt;\/script&gt;\n\n&lt;\/body&gt;\n&lt;\/html&gt;\n\n\n\n\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Menurut wikipedia, Base64 adalah sekelompok skema pengkodean biner-ke-teks yang mewakili data biner dalam format string ASCII dengan menerjemahkannya ke dalam representasi radix-64. Wahh ribet ya<\/p>\n","protected":false},"author":1,"featured_media":4309,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[1562,35,2710],"class_list":["post-8744","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-belajar-web-programming","tag-belajar-jquery","tag-belajar-web-programming-2","tag-konversi-base64"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Konversi Gambar ke Base64 dengan jQuery - WebHozz Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Konversi Gambar ke Base64 dengan jQuery - WebHozz Blog\" \/>\n<meta property=\"og:description\" content=\"Menurut wikipedia, Base64 adalah sekelompok skema pengkodean biner-ke-teks yang mewakili data biner dalam format string ASCII dengan menerjemahkannya ke dalam representasi radix-64. Wahh ribet ya\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHozz Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-07-03T08:55:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-07-16T10:37:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2017\/04\/jquery-logo-new-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"593\" \/>\n\t<meta property=\"og:image:height\" content=\"323\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#\\\/schema\\\/person\\\/d5f539ad171dc74baaf6a98dfef6fcef\"},\"headline\":\"Konversi Gambar ke Base64 dengan jQuery\",\"datePublished\":\"2019-07-03T08:55:15+00:00\",\"dateModified\":\"2019-07-16T10:37:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/\"},\"wordCount\":74,\"publisher\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/04\\\/jquery-logo-new-1.jpg\",\"keywords\":[\"Belajar Jquery\",\"belajar web programming\",\"konversi base64\"],\"articleSection\":[\"Belajar Web Programming\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/\",\"name\":\"Konversi Gambar ke Base64 dengan jQuery - WebHozz Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/04\\\/jquery-logo-new-1.jpg\",\"datePublished\":\"2019-07-03T08:55:15+00:00\",\"dateModified\":\"2019-07-16T10:37:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/04\\\/jquery-logo-new-1.jpg\",\"contentUrl\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/04\\\/jquery-logo-new-1.jpg\",\"width\":593,\"height\":323},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/konversi-gambar-ke-base64-dengan-jquery\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Konversi Gambar ke Base64 dengan jQuery\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/\",\"name\":\"WebHozz Blog\",\"description\":\"Kursus Web &amp; Android di Jakarta Bandung\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#organization\",\"name\":\"WebHozz\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/logo-persegi.jpg\",\"contentUrl\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/logo-persegi.jpg\",\"width\":442,\"height\":442,\"caption\":\"WebHozz\"},\"image\":{\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/#\\\/schema\\\/person\\\/d5f539ad171dc74baaf6a98dfef6fcef\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"url\":\"https:\\\/\\\/www.webhozz.com\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Konversi Gambar ke Base64 dengan jQuery - WebHozz Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/","og_locale":"en_US","og_type":"article","og_title":"Konversi Gambar ke Base64 dengan jQuery - WebHozz Blog","og_description":"Menurut wikipedia, Base64 adalah sekelompok skema pengkodean biner-ke-teks yang mewakili data biner dalam format string ASCII dengan menerjemahkannya ke dalam representasi radix-64. Wahh ribet ya","og_url":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/","og_site_name":"WebHozz Blog","article_published_time":"2019-07-03T08:55:15+00:00","article_modified_time":"2019-07-16T10:37:59+00:00","og_image":[{"width":593,"height":323,"url":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2017\/04\/jquery-logo-new-1.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/#article","isPartOf":{"@id":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/"},"author":{"name":"admin","@id":"https:\/\/www.webhozz.com\/blog\/#\/schema\/person\/d5f539ad171dc74baaf6a98dfef6fcef"},"headline":"Konversi Gambar ke Base64 dengan jQuery","datePublished":"2019-07-03T08:55:15+00:00","dateModified":"2019-07-16T10:37:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/"},"wordCount":74,"publisher":{"@id":"https:\/\/www.webhozz.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2017\/04\/jquery-logo-new-1.jpg","keywords":["Belajar Jquery","belajar web programming","konversi base64"],"articleSection":["Belajar Web Programming"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/","url":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/","name":"Konversi Gambar ke Base64 dengan jQuery - WebHozz Blog","isPartOf":{"@id":"https:\/\/www.webhozz.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/#primaryimage"},"image":{"@id":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2017\/04\/jquery-logo-new-1.jpg","datePublished":"2019-07-03T08:55:15+00:00","dateModified":"2019-07-16T10:37:59+00:00","breadcrumb":{"@id":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/#primaryimage","url":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2017\/04\/jquery-logo-new-1.jpg","contentUrl":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2017\/04\/jquery-logo-new-1.jpg","width":593,"height":323},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhozz.com\/blog\/konversi-gambar-ke-base64-dengan-jquery\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhozz.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Konversi Gambar ke Base64 dengan jQuery"}]},{"@type":"WebSite","@id":"https:\/\/www.webhozz.com\/blog\/#website","url":"https:\/\/www.webhozz.com\/blog\/","name":"WebHozz Blog","description":"Kursus Web &amp; Android di Jakarta Bandung","publisher":{"@id":"https:\/\/www.webhozz.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhozz.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhozz.com\/blog\/#organization","name":"WebHozz","url":"https:\/\/www.webhozz.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhozz.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2018\/04\/logo-persegi.jpg","contentUrl":"https:\/\/www.webhozz.com\/blog\/wp-content\/uploads\/2018\/04\/logo-persegi.jpg","width":442,"height":442,"caption":"WebHozz"},"image":{"@id":"https:\/\/www.webhozz.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.webhozz.com\/blog\/#\/schema\/person\/d5f539ad171dc74baaf6a98dfef6fcef","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bff35e4083f3870e2f911c4437e788147d340f274268d361dd7e1cf20bebb156?s=96&d=mm&r=g","caption":"admin"},"url":"https:\/\/www.webhozz.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/posts\/8744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/comments?post=8744"}],"version-history":[{"count":1,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/posts\/8744\/revisions"}],"predecessor-version":[{"id":8747,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/posts\/8744\/revisions\/8747"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/media\/4309"}],"wp:attachment":[{"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/media?parent=8744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/categories?post=8744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhozz.com\/blog\/wp-json\/wp\/v2\/tags?post=8744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}