{"id":63680,"date":"2024-06-10T17:26:51","date_gmt":"2024-06-10T08:26:51","guid":{"rendered":"https:\/\/www.heartlife.or.jp\/hospital\/?page_id=63680"},"modified":"2024-06-11T13:54:51","modified_gmt":"2024-06-11T04:54:51","slug":"omimai-photo350","status":"publish","type":"page","link":"https:\/\/www.heartlife.or.jp\/hospital\/omimai-photo350\/","title":{"rendered":"\u304a\u898b\u821e\u3044\u30fb\u51fa\u7523\u795d\u3044\u30e1\u30fc\u30eb\uff08\u5199\u771f\u4ed8\u304d350\u5b57\u307e\u3067\uff09"},"content":{"rendered":"<p>[mwform_formkey key=&#8221;63679&#8243;]<\/p>\n\n\n\n<script>\nif(jQuery('#photo').length > 0){\n\tjQuery('#photo').on('click',function(){\n\t\t\/\/\u30d5\u30a1\u30a4\u30eb\u8981\u7d20\u3068\u30ea\u30b5\u30a4\u30ba\u5f8c\u306e\u30c7\u30fc\u30bf\u3092\u7a7a\u306b\u3059\u308b\n\t\tif(jQuery('#photo').val() == ''){\n\t\t\tjQuery('input[name=\"resizePhoto\"]').val('');\n\t\t\tjQuery('#preview').hide();\n\t\t}\n\t});\n\t\n\tjQuery('#photo').on('change',function(){\n\tif(jQuery('#photo').attr('type') == 'file'){\n\t\t\/\/console.log('change');\n\t\tlet fr = new FileReader();\n\t\tlet image = new Image();\n\t\t\/\/console.log(JSON.stringify(jQuery('#photo')));\n\t\tfr.onload = function(){\n\t\t\timage.src = fr.result;\n\t\t\timage.onload = function() {\n\t\t\t\t\/*\u6a2a\u4f4d\u7f6e\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u78ba\u8a8d*\/\n\t\t\t\tlet orgWidth = image.naturalWidth;\n\t\t\t\tlet orgHeight = image.naturalHeight;\n\t\t\t\tif(orgWidth < orgHeight){\n\t\t\t\t\twindow.alert('4:3\u6a2a\u5411\u304d\u306e\u753b\u50cf\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044');\n\t\t\t\t\tjQuery('#photo').val('');\n\t\t\t\t}\n\t\t\t\telse{\n\n\t\t\t\t\t\/\/\u30d7\u30ec\u30d3\u30e5\u30fc\u8868\u793a\n\t\t\t\t\t\/\/jQuery('#preview').attr('src', fr.result);\n\t\t\t\t\tlet canvas = jQuery('#preview');\n\t\t\t\t\tlet context = canvas[0].getContext(\"2d\");\n\t\t\t\t\t\/*\u30ab\u30f3\u30d0\u30b9\u306b\u5408\u308f\u305b\u3066\u30ea\u30b5\u30a4\u30ba*\/\n\t\t\t\t\tlet reHeight = orgHeight \/ 10;\n\t\t\t\t\tlet reWidth = orgWidth\/10;\n\n\t\t\t\t\tcanvas.attr('width' , reWidth);\n\t\t\t\t\tcanvas.attr('height' , reHeight);\n\t\t\t\t\tjQuery('#preview').show();\n\n\t\t\t\t\tcontext.drawImage(image,0,0,orgWidth,orgHeight,0,0,reWidth,reHeight);\n\n\t\t\t\t\t\/*\u30ab\u30f3\u30d0\u30b9\u306b\u5408\u308f\u305b\u3066\u30ea\u30b5\u30a4\u30ba*\/\n\t\t\t\t\tlet sendHeight = orgHeight \/ 3;\n\t\t\t\t\tlet sendWidth = orgWidth\/3;\n\n\t\t\t\t\tlet sendCanvas=jQuery('#sendPhoto');\n\t\t\t\t\tsendCanvas.attr('width' , sendWidth);\n\t\t\t\t\tsendCanvas.attr('height' , sendHeight);\n\t\t\t\t\tlet context2 = sendCanvas[0].getContext(\"2d\");\n\t\t\t\t\tcontext2.drawImage(image,0,0,orgWidth,orgHeight,0,0,sendWidth,sendHeight);\n\t\t\t\t\tjQuery('#sendPhoto').hide();\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\/\/\u9001\u4fe1\u7528\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\n\t\t\t\t\t\/\/window.alert(reHeight);\n\t\t\t\t\tlet canvasData = jQuery('#sendPhoto')[0];\n\t\t\t\t\tlet png = canvasData.toDataURL();\n\t\t\t\t\t\/\/\u306a\u305c\u304bID\u304c\u51fa\u529b\u3055\u308c\u306a\u3044\u306e\u3067name\u3067\u6307\u5b9a\n\t\t\t\t\tjQuery('input[name=\"sendPhoto\"]').val(png);\n\t\t\t\t\t\/\/\u64ae\u5f71\u30c7\u30fc\u30bf\u81ea\u4f53\u306f\u91cd\u3044\u306e\u3067\u9001\u4fe1\u3057\u306a\u3044\u3002\u524a\u9664\n\t\t\t\t\tjQuery('#photo').val('');\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tfr.readAsDataURL(jQuery('#photo')[0].files[0]);\n\n\n\t}\n\n\t});\n\t\n}\n<\/script>\n\n\n\n<script src=\"\/js\/mwwp.js\"><\/script>\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"\/css\/mwwp.css\" \/>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":6,"featured_media":0,"parent":0,"menu_order":270,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[],"class_list":["post-63680","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.heartlife.or.jp\/hospital\/wp-json\/wp\/v2\/pages\/63680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.heartlife.or.jp\/hospital\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.heartlife.or.jp\/hospital\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.heartlife.or.jp\/hospital\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.heartlife.or.jp\/hospital\/wp-json\/wp\/v2\/comments?post=63680"}],"version-history":[{"count":22,"href":"https:\/\/www.heartlife.or.jp\/hospital\/wp-json\/wp\/v2\/pages\/63680\/revisions"}],"predecessor-version":[{"id":63720,"href":"https:\/\/www.heartlife.or.jp\/hospital\/wp-json\/wp\/v2\/pages\/63680\/revisions\/63720"}],"wp:attachment":[{"href":"https:\/\/www.heartlife.or.jp\/hospital\/wp-json\/wp\/v2\/media?parent=63680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.heartlife.or.jp\/hospital\/wp-json\/wp\/v2\/categories?post=63680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}