{"id":3781,"date":"2026-11-08T15:29:42","date_gmt":"2026-11-08T06:29:42","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=3781"},"modified":"2026-11-08T15:29:42","modified_gmt":"2026-11-08T06:29:42","slug":"20261024-00mvllyl","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2026\/11\/08\/20261024-00mvllyl\/","title":{"rendered":"Cropper.js\u3068jquery-cropper\u3067\u4f5c\u308b\u753b\u50cf\u5207\u308a\u629c\u304dUI\u5165\u9580"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>\u30e6\u30fc\u30b6\u30fc\u304c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u305f\u753b\u50cf\u3092\u3001\u30b5\u30fc\u30d0\u30fc\u306b\u9001\u308b\u524d\u306b\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u5207\u308a\u629c\u304f\u2014\u2014\u30d7\u30ed\u30d5\u30a3\u30fc\u30eb\u753b\u50cf\u3084\u30b5\u30e0\u30cd\u30a4\u30eb\u306e\u767b\u9332\u3067\u306f\u5b9a\u756a\u306eUI\u3067\u3059\u3002\u81ea\u524d\u3067\u5b9f\u88c5\u3059\u308b\u3068\u30c9\u30e9\u30c3\u30b0\u51e6\u7406\u30fb\u30ea\u30b5\u30a4\u30ba\u30cf\u30f3\u30c9\u30eb\u30fb\u30a2\u30b9\u30da\u30af\u30c8\u6bd4\u306e\u56fa\u5b9a\u306a\u3069\u3067\u4e00\u6c17\u306b\u8907\u96d1\u306b\u306a\u308a\u307e\u3059\u304c\u3001<a href=\"https:\/\/github.com\/fengyuanchen\/cropperjs\">Cropper.js<\/a> \u3092\u4f7f\u3048\u3070\u6570\u884c\u3067\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001\u7d20\u306eCropper.js\u3067\u306e\u6700\u5c0f\u5b9f\u88c5\u3068\u3001jQuery\u30d9\u30fc\u30b9\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5411\u3051\u30e9\u30c3\u30d1\u30fc\u3067\u3042\u308b <a href=\"https:\/\/github.com\/fengyuanchen\/jquery-cropper\">jquery-cropper<\/a> \u3067\u306e\u66f8\u304d\u65b9\u3092\u5165\u9580\u3068\u3057\u3066\u6574\u7406\u3057\u307e\u3059\u3002\u30a2\u30b9\u30da\u30af\u30c8\u6bd4\u56fa\u5b9a\u3001\u5207\u308a\u629c\u304d\u7d50\u679c\u306e\u53d6\u5f97\uff08Canvas \/ Blob\uff09\u3001\u30b5\u30fc\u30d0\u30fc\u9001\u4fe1\u307e\u3067\u3092\u4e00\u901a\u308a\u6271\u3044\u307e\u3059\u3002<\/p>\n<h2>\u74b0\u5883<\/h2>\n<ul>\n<li>Cropper.js v1 \u7cfb\uff08\u672c\u8a18\u4e8b\u306e\u8a18\u8ff0\u306f v1.6 \u3092\u60f3\u5b9a\uff09<\/li>\n<li>jquery-cropper \u3092\u4f7f\u3046\u5834\u5408\u306f jQuery 1.9.1 \u4ee5\u964d + Cropper.js<\/li>\n<li>\u52d5\u4f5c\u78ba\u8a8d\u30d6\u30e9\u30a6\u30b6: \u6700\u65b0\u306e Chrome \/ Firefox \/ Safari<\/li>\n<\/ul>\n<p>&gt; <strong>\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u95a2\u3059\u308b\u6ce8\u610f<\/strong>\uff1aCropper.js \u306b\u306f v1\uff08<code>cropperjs<\/code>\uff09\u3068\u3001UI\/API\u3092\u5237\u65b0\u3057\u305f\u5f8c\u7d99\u306e v2 \u304c\u3042\u308a\u307e\u3059\u3002v2 \u306fWeb Components\u30d9\u30fc\u30b9\u3067\u672c\u8a18\u4e8b\u306eAPI\u3068\u306f\u4e92\u63db\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u65e2\u5b58\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3084jquery-cropper\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u524d\u63d0\u3067\u306f v1 \u7cfb\u304c\u5b9f\u7e3e\u8c4a\u5bcc\u3067\u3059\u3002\u672c\u8a18\u4e8b\u306f v1 \u7cfb\u3092\u524d\u63d0\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u5c0e\u5165<\/h2>\n<h3>CDN\u3067\u8aad\u307f\u8fbc\u3080<\/h3>\n<p>\u3082\u3063\u3068\u3082\u624b\u8efd\u306a\u306e\u306fCDN\u3067\u3059\u3002CSS\u3068JS\u306e\u4e21\u65b9\u304c\u5fc5\u8981\u306a\u70b9\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"lang:default decode:true\">&lt;!-- CSS --&gt;\n&lt;link\n  rel=\"stylesheet\"\n  href=\"https:\/\/cdn.jsdelivr.net\/npm\/cropperjs@1.6.2\/dist\/cropper.min.css\"\n\/&gt;\n\n&lt;!-- JS --&gt;\n&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/cropperjs@1.6.2\/dist\/cropper.min.js\"&gt;&lt;\/script&gt;<\/pre>\n<p>jquery-cropper\u3092\u4f7f\u3046\u5834\u5408\u306f\u3001jQuery \u2192 Cropper.js \u2192 jquery-cropper \u306e\u9806\u3067\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">&lt;script src=\"https:\/\/code.jquery.com\/jquery-3.7.1.min.js\"&gt;&lt;\/script&gt;\n&lt;link\n  rel=\"stylesheet\"\n  href=\"https:\/\/cdn.jsdelivr.net\/npm\/cropperjs@1.6.2\/dist\/cropper.min.css\"\n\/&gt;\n&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/cropperjs@1.6.2\/dist\/cropper.min.js\"&gt;&lt;\/script&gt;\n&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/jquery-cropper@1.0.1\/dist\/jquery-cropper.min.js\"&gt;&lt;\/script&gt;<\/pre>\n<h3>npm\u3067\u5c0e\u5165\u3059\u308b<\/h3>\n<p>\u30d0\u30f3\u30c9\u30e9\u3092\u4f7f\u3046\u5834\u5408\u306f npm \u7d4c\u7531\u304c\u7ba1\u7406\u3057\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">npm install cropperjs\n# jQuery\u9023\u643a\u3059\u308b\u5834\u5408\nnpm install jquery jquery-cropper<\/pre>\n<pre class=\"lang:default decode:true\">import Cropper from \"cropperjs\";\nimport \"cropperjs\/dist\/cropper.css\";<\/pre>\n<p>&gt; <strong>\u6ce8\u610f<\/strong>\uff1aCSS\u306e\u8aad\u307f\u8fbc\u307f\u5fd8\u308c\u306f\u6700\u983b\u51fa\u306e\u30cf\u30de\u308a\u3069\u3053\u308d\u3067\u3059\u3002CSS\u304c\u7121\u3044\u3068\u30af\u30ed\u30c3\u30d7\u30dc\u30c3\u30af\u30b9\u3084\u30cf\u30f3\u30c9\u30eb\u306e\u30b9\u30bf\u30a4\u30eb\u304c\u5d29\u308c\u3001\u30c9\u30e9\u30c3\u30b0\u9818\u57df\u304c\u898b\u3048\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u300c\u52d5\u304b\u306a\u3044\u300d\u3068\u611f\u3058\u305f\u3089\u307e\u305aCSS\u3092\u7591\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u6700\u5c0f\u5b9f\u88c5\uff08\u7d20\u306eCropper.js\uff09<\/h2>\n<p>\u307e\u305a\u306fHTML\u3002Cropper.js\u306f <code>&lt;img&gt;<\/code> \u307e\u305f\u306f <code>&lt;canvas&gt;<\/code> \u3092\u5bfe\u8c61\u306b\u521d\u671f\u5316\u3057\u307e\u3059\u3002<strong>\u30e9\u30c3\u30d7\u3059\u308b\u89aa\u8981\u7d20\u306b\u5e45\u3092\u6301\u305f\u305b\u308b<\/strong>\u306e\u304c\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">&lt;div class=\"img-container\" style=\"max-width: 600px;\"&gt;\n  &lt;img id=\"image\" src=\"\/path\/to\/picture.jpg\" alt=\"\u7de8\u96c6\u5bfe\u8c61\u306e\u753b\u50cf\" \/&gt;\n&lt;\/div&gt;<\/pre>\n<p>JavaScript\u5074\u3067\u521d\u671f\u5316\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">const image = document.getElementById(\"image\");\n\nconst cropper = new Cropper(image, {\n  aspectRatio: 16 \/ 9, \/\/ \u30a2\u30b9\u30da\u30af\u30c8\u6bd4\u309216:9\u306b\u56fa\u5b9a\n  viewMode: 1,         \/\/ \u30af\u30ed\u30c3\u30d7\u30dc\u30c3\u30af\u30b9\u3092\u753b\u50cf\u306e\u5185\u5074\u306b\u5236\u9650\n});<\/pre>\n<p>\u3053\u308c\u3060\u3051\u3067\u3001\u30c9\u30e9\u30c3\u30b0\u3067\u30af\u30ed\u30c3\u30d7\u30dc\u30c3\u30af\u30b9\u3092\u52d5\u304b\u3057\u3001\u56db\u9685\u30fb\u56db\u8fba\u306e\u30cf\u30f3\u30c9\u30eb\u3067\u30ea\u30b5\u30a4\u30ba\u3067\u304d\u308bUI\u304c\u5b8c\u6210\u3057\u307e\u3059\u3002<\/p>\n<h3>\u3088\u304f\u4f7f\u3046\u30aa\u30d7\u30b7\u30e7\u30f3<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u30aa\u30d7\u30b7\u30e7\u30f3<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>aspectRatio<\/code><\/td>\n<td>\u5207\u308a\u629c\u304d\u6bd4\u7387\u3092\u56fa\u5b9a\u3002<code>NaN<\/code>\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\uff09\u3067\u81ea\u7531\u6bd4\u7387<\/td>\n<\/tr>\n<tr>\n<td><code>viewMode<\/code><\/td>\n<td><code>0<\/code>\u301c<code>3<\/code>\u3002<code>1<\/code> \u4ee5\u4e0a\u3067\u30af\u30ed\u30c3\u30d7\u30dc\u30c3\u30af\u30b9\u304c\u753b\u50cf\u5916\u306b\u51fa\u306a\u3044\u3088\u3046\u5236\u9650<\/td>\n<\/tr>\n<tr>\n<td><code>dragMode<\/code><\/td>\n<td><code>'crop'<\/code>\uff08\u65b0\u898f\u30dc\u30c3\u30af\u30b9\u63cf\u753b\uff09 \/ <code>'move'<\/code>\uff08\u753b\u50cf\u79fb\u52d5\uff09 \/ <code>'none'<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>autoCropArea<\/code><\/td>\n<td>\u521d\u671f\u30af\u30ed\u30c3\u30d7\u30dc\u30c3\u30af\u30b9\u306e\u5927\u304d\u3055\uff080\u301c1\u306e\u5272\u5408\uff09<\/td>\n<\/tr>\n<tr>\n<td><code>movable<\/code> \/ <code>zoomable<\/code> \/ <code>rotatable<\/code><\/td>\n<td>\u753b\u50cf\u306e\u79fb\u52d5\u30fb\u30ba\u30fc\u30e0\u30fb\u56de\u8ee2\u306e\u53ef\u5426<\/td>\n<\/tr>\n<tr>\n<td><code>responsive<\/code><\/td>\n<td>\u30a6\u30a3\u30f3\u30c9\u30a6\u30ea\u30b5\u30a4\u30ba\u6642\u306b\u518d\u63cf\u753b\u3059\u308b\u304b\uff08\u30c7\u30d5\u30a9\u30eb\u30c8 true\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u30d7\u30ed\u30d5\u30a3\u30fc\u30eb\u753b\u50cf\u306e\u3088\u3046\u306b\u6b63\u65b9\u5f62\u3067\u5207\u308a\u629c\u304d\u305f\u3044\u3068\u304d\u306f <code>aspectRatio: 1<\/code> \u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<h2>\u5207\u308a\u629c\u304d\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b<\/h2>\n<p>\u30e6\u30fc\u30b6\u30fc\u304c\u5207\u308a\u629c\u3044\u305f\u7bc4\u56f2\u3092\u5b9f\u969b\u306e\u30c7\u30fc\u30bf\u3068\u3057\u3066\u53d6\u308a\u51fa\u3057\u307e\u3059\u3002\u4ee3\u8868\u7684\u306a\u306e\u306f <code>getCroppedCanvas()<\/code> \u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">\/\/ Canvas\u3068\u3057\u3066\u53d6\u5f97\uff08\u51fa\u529b\u30b5\u30a4\u30ba\u3082\u6307\u5b9a\u3067\u304d\u308b\uff09\nconst canvas = cropper.getCroppedCanvas({\n  width: 400,\n  height: 400,\n  imageSmoothingQuality: \"high\",\n});\n\n\/\/ 1) data URL\uff08\u30d7\u30ec\u30d3\u30e5\u30fc\u8868\u793a\u306a\u3069\u306b\uff09\nconst dataUrl = canvas.toDataURL(\"image\/jpeg\", 0.9);\ndocument.getElementById(\"preview\").src = dataUrl;\n\n\/\/ 2) Blob\uff08\u30b5\u30fc\u30d0\u30fc\u9001\u4fe1\u306b\u6700\u9069\uff09\ncanvas.toBlob(\n  (blob) =&gt; {\n    const formData = new FormData();\n    formData.append(\"avatar\", blob, \"avatar.jpg\");\n\n    fetch(\"\/api\/upload\", {\n      method: \"POST\",\n      body: formData,\n    });\n  },\n  \"image\/jpeg\",\n  0.9\n);<\/pre>\n<p>&gt; <strong>\u88dc\u8db3<\/strong>\uff1a\u30b5\u30fc\u30d0\u30fc\u9001\u4fe1\u3067\u306f data URL\uff08base64\u6587\u5b57\u5217\uff09\u3088\u308a <strong>Blob + FormData<\/strong> \u3092\u63a8\u5968\u3057\u307e\u3059\u3002base64\u306f\u5143\u30c7\u30fc\u30bf\u3088\u308a\u7d0433%\u5927\u304d\u304f\u306a\u308a\u3001\u5de8\u5927\u306a\u6587\u5b57\u5217\u3092JSON\u306b\u8a70\u3081\u308b\u3068\u5e2f\u57df\u3082\u30e1\u30e2\u30ea\u3082\u7121\u99c4\u304c\u51fa\u307e\u3059\u3002<code>toBlob()<\/code> \u306a\u3089\u30d0\u30a4\u30ca\u30ea\u306e\u307e\u307e multipart \u3067\u9001\u308c\u307e\u3059\u3002<\/p>\n<p>\u5ea7\u6a19\u3060\u3051\u6b32\u3057\u3044\u5834\u5408\u306f <code>getData()<\/code> \u3067\u5207\u308a\u629c\u304d\u77e9\u5f62\u306e\u6570\u5024\uff08<code>x<\/code> \/ <code>y<\/code> \/ <code>width<\/code> \/ <code>height<\/code> \/ <code>rotate<\/code> \u306a\u3069\uff09\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002\u30b5\u30fc\u30d0\u30fc\u5074\u3067\u5207\u308a\u629c\u304d\u3092\u884c\u3046\u8a2d\u8a08\u306a\u3089\u3001\u3053\u306e\u5ea7\u6a19\u3060\u3051\u9001\u308b\u306e\u3082\u624b\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">const data = cropper.getData();\n\/\/ { x, y, width, height, rotate, scaleX, scaleY }<\/pre>\n<h2>jquery-cropper\u3067\u306e\u66f8\u304d\u65b9<\/h2>\n<p>\u65e2\u5b58\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304cjQuery\u30d9\u30fc\u30b9\u306a\u3089\u3001jquery-cropper\u3067\u30e1\u30bd\u30c3\u30c9\u30c1\u30a7\u30fc\u30f3\u306b\u99b4\u67d3\u307e\u305b\u3089\u308c\u307e\u3059\u3002\u4e2d\u8eab\u306fCropper.js\u305d\u306e\u307e\u307e\u3067\u3001<code>$(...).cropper(...)<\/code> \u3068\u3044\u3046\u547c\u3073\u51fa\u3057\u5f62\u5f0f\u3092\u63d0\u4f9b\u3059\u308b\u30e9\u30c3\u30d1\u30fc\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">const $image = $(\"#image\");\n\n\/\/ \u521d\u671f\u5316\n$image.cropper({\n  aspectRatio: 1,\n  viewMode: 1,\n});\n\n\/\/ \u30e1\u30bd\u30c3\u30c9\u547c\u3073\u51fa\u3057: cropper('\u30e1\u30bd\u30c3\u30c9\u540d', \u5f15\u6570)\n$image.cropper(\"rotate\", 90);              \/\/ 90\u5ea6\u56de\u8ee2\n$image.cropper(\"zoom\", 0.1);               \/\/ \u30ba\u30fc\u30e0\n$image.cropper(\"setAspectRatio\", 16 \/ 9);  \/\/ \u6bd4\u7387\u5909\u66f4\n$image.cropper(\"reset\");                   \/\/ \u30ea\u30bb\u30c3\u30c8\n\n\/\/ \u5207\u308a\u629c\u304dCanvas\u306e\u53d6\u5f97\nconst canvas = $image.cropper(\"getCroppedCanvas\");\n\n\/\/ \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u7834\u68c4\n$image.cropper(\"destroy\");<\/pre>\n<p>\u623b\u308a\u5024\u304c\u5fc5\u8981\u306a\u30e1\u30bd\u30c3\u30c9\uff08<code>getCroppedCanvas<\/code> \/ <code>getData<\/code> \u306a\u3069\uff09\u306f\u3001\u7d20\u306eCropper.js\u3068\u540c\u3058\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30d5\u30a1\u30a4\u30eb\u9078\u629e\u3068\u9023\u52d5\u3055\u305b\u308b<\/h2>\n<p>\u5b9f\u904b\u7528\u3067\u306f <code>&lt;input type=\"file\"&gt;<\/code> \u3067\u9078\u3070\u308c\u305f\u753b\u50cf\u3092\u8aad\u307f\u8fbc\u307f\u76f4\u3059\u6d41\u308c\u304c\u5b9a\u756a\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">&lt;input type=\"file\" id=\"fileInput\" accept=\"image\/*\" \/&gt;\n&lt;div class=\"img-container\" style=\"max-width: 600px;\"&gt;\n  &lt;img id=\"image\" alt=\"\" \/&gt;\n&lt;\/div&gt;<\/pre>\n<pre class=\"lang:default decode:true\">const fileInput = document.getElementById(\"fileInput\");\nconst image = document.getElementById(\"image\");\nlet cropper = null;\n\nfileInput.addEventListener(\"change\", (e) =&gt; {\n  const file = e.target.files[0];\n  if (!file) return;\n\n  const url = URL.createObjectURL(file);\n  image.src = url;\n\n  if (cropper) {\n    \/\/ \u65e2\u5b58\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u3042\u308c\u3070\u753b\u50cf\u3060\u3051\u5dee\u3057\u66ff\u3048\u308b\n    cropper.replace(url);\n  } else {\n    cropper = new Cropper(image, {\n      aspectRatio: 1,\n      viewMode: 1,\n    });\n  }\n});<\/pre>\n<p>&gt; <strong>\u30e1\u30e2\u30ea\u7ba1\u7406<\/strong>\uff1a<code>URL.createObjectURL()<\/code> \u3067\u4f5c\u3063\u305fURL\u306f <code>URL.revokeObjectURL()<\/code> \u3067\u89e3\u653e\u3059\u308b\u3068\u30e1\u30e2\u30ea\u30ea\u30fc\u30af\u3092\u9632\u3052\u307e\u3059\u3002\u753b\u50cf\u306e <code>load<\/code> \u30a4\u30d9\u30f3\u30c8\u5f8c\u3084\u3001\u6b21\u306e\u753b\u50cf\u306b\u5dee\u3057\u66ff\u3048\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u89e3\u653e\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u78ba\u8a8d\u65b9\u6cd5<\/h2>\n<ol>\n<li>\u30da\u30fc\u30b8\u3092\u958b\u304d\u3001\u753b\u50cf\u4e0a\u3067\u30c9\u30e9\u30c3\u30b0\u3057\u3066\u30af\u30ed\u30c3\u30d7\u30dc\u30c3\u30af\u30b9\u304c\u52d5\u304f\u3053\u3068<\/li>\n<li>\u56db\u9685\u30fb\u56db\u8fba\u306e\u30cf\u30f3\u30c9\u30eb\u3067\u30ea\u30b5\u30a4\u30ba\u3067\u304d\u308b\u3053\u3068<\/li>\n<li><code>aspectRatio<\/code> \u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u3001\u6bd4\u7387\u304c\u56fa\u5b9a\u3055\u308c\u305f\u307e\u307e\u30ea\u30b5\u30a4\u30ba\u3055\u308c\u308b\u3053\u3068<\/li>\n<li>\u5207\u308a\u629c\u304d\u30dc\u30bf\u30f3\u3067 <code>getCroppedCanvas()<\/code> \u306e\u7d50\u679c\u3092\u30d7\u30ec\u30d3\u30e5\u30fc\u306b\u8868\u793a\u3067\u304d\u308b\u3053\u3068<\/li>\n<li>\u9001\u4fe1\u5f8c\u3001\u30b5\u30fc\u30d0\u30fc\u5074\u306b\u6307\u5b9a\u30b5\u30a4\u30ba\u306e\u753b\u50cf\u304c\u5c4a\u304f\u3053\u3068\uff08\u51fa\u529b <code>width<\/code>\/<code>height<\/code> \u3068\u4e00\u81f4\u3059\u308b\u304b\uff09<\/li>\n<\/ol>\n<p>\u30c7\u30d0\u30c3\u30b0\u6642\u306f <code>cropper.getData()<\/code> \u3092\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u51fa\u3057\u3001\u5ea7\u6a19\u304c\u671f\u5f85\u901a\u308a\u304b\u78ba\u8a8d\u3059\u308b\u3068\u539f\u56e0\u306e\u5207\u308a\u5206\u3051\u304c\u65e9\u3044\u3067\u3059\u3002<\/p>\n<h2>\u6ce8\u610f\u70b9<\/h2>\n<ul>\n<li><strong>CSS\u306e\u8aad\u307f\u8fbc\u307f\u306f\u5fc5\u9808<\/strong>\u3002\u5d29\u308c\u305f\u3089\u771f\u3063\u5148\u306b\u7591\u3046\u3002<\/li>\n<li>\u753b\u50cf\u306f <code>crossOrigin<\/code> \u306b\u6ce8\u610f\u3002\u5225\u30aa\u30ea\u30b8\u30f3\u306e\u753b\u50cf\u3092 <code>getCroppedCanvas()<\/code> \u3059\u308b\u3068 Canvas \u304c\u6c5a\u67d3\uff08tainted\uff09\u3055\u308c\u3001<code>toDataURL<\/code> \/ <code>toBlob<\/code> \u304c\u5931\u6557\u3057\u307e\u3059\u3002CORS\u5bfe\u5fdc\u3057\u305fURL\u3092\u4f7f\u3046\u304b\u3001\u30b5\u30fc\u30d0\u30fc\u7d4c\u7531\u3067\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/li>\n<li><code>viewMode: 0<\/code> \u3060\u3068\u30af\u30ed\u30c3\u30d7\u30dc\u30c3\u30af\u30b9\u304c\u753b\u50cf\u5916\u306b\u51fa\u3089\u308c\u308b\u305f\u3081\u3001\u610f\u56f3\u3057\u306a\u3044\u4f59\u767d\u304c\u5165\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u591a\u304f\u306eUI\u3067\u306f <code>viewMode: 1<\/code> \u304c\u7121\u96e3\u3067\u3059\u3002<\/li>\n<li>\u521d\u671f\u5316\u5bfe\u8c61\u306e <code>&lt;img&gt;<\/code> \u306f\u3001\u89aa\u8981\u7d20\u306b\u5e45\u304c\u306a\u3044\u3068\u8868\u793a\u3055\u308c\u306a\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<li>v1 \u3068 v2 \u3067API\u304c\u5927\u304d\u304f\u7570\u306a\u308a\u307e\u3059\u3002\u8a18\u4e8b\u30fb\u30b5\u30f3\u30d7\u30eb\u3092\u53c2\u7167\u3059\u308b\u3068\u304d\u306f\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/li>\n<li>\u30e2\u30d0\u30a4\u30eb\u3067\u306f\u30bf\u30c3\u30c1\u64cd\u4f5c\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30d4\u30f3\u30c1\u30ba\u30fc\u30e0\u306a\u3069\u30d6\u30e9\u30a6\u30b6\u6a19\u6e96\u306e\u30b8\u30a7\u30b9\u30c1\u30e3\u3068\u7af6\u5408\u3059\u308b\u5834\u5408\u304c\u3042\u308b\u305f\u3081\u5b9f\u6a5f\u78ba\u8a8d\u3092\u63a8\u5968\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>Cropper.js \u306f\u3001\u753b\u50cf\u5207\u308a\u629c\u304dUI\u3067\u5fc5\u8981\u306b\u306a\u308b\u300c\u30c9\u30e9\u30c3\u30b0\u30fb\u30ea\u30b5\u30a4\u30ba\u30fb\u6bd4\u7387\u56fa\u5b9a\u30fb\u7d50\u679c\u306e\u53d6\u308a\u51fa\u3057\u300d\u3092\u307e\u3068\u3081\u3066\u5f15\u304d\u53d7\u3051\u3066\u304f\u308c\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\u5165\u9580\u3068\u3057\u3066\u306f\u6b21\u306e3\u70b9\u3092\u62bc\u3055\u3048\u308c\u3070\u5341\u5206\u306b\u52d5\u304b\u305b\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>new Cropper(img, options)<\/code> \u3067\u521d\u671f\u5316\uff08CSS\u5fc5\u9808\u30fb\u89aa\u8981\u7d20\u306b\u5e45\uff09<\/li>\n<li><code>getCroppedCanvas()<\/code> \u2192 <code>toBlob()<\/code> + <code>FormData<\/code> \u3067\u30b5\u30fc\u30d0\u30fc\u9001\u4fe1<\/li>\n<li>jQuery\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306a\u3089 jquery-cropper \u3067 <code>$(...).cropper(...)<\/code> \u5f62\u5f0f\u306b\u7d71\u4e00<\/li>\n<\/ul>\n<p>\u307e\u305a\u306f <code>aspectRatio: 1<\/code> \u306e\u30d7\u30ed\u30d5\u30a3\u30fc\u30eb\u753b\u50cf\u5207\u308a\u629c\u304d\u304b\u3089\u59cb\u3081\u308b\u3068\u3001\u5168\u4f53\u306e\u6d41\u308c\u304c\u3064\u304b\u307f\u3084\u3059\u3044\u306f\u305a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30e6\u30fc\u30b6\u30fc\u304c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u305f\u753b\u50cf\u3092\u3001\u30b5\u30fc\u30d0\u30fc\u306b\u9001\u308b\u524d\u306b\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u5207\u308a\u629c\u304f\u2014\u2014\u30d7\u30ed\u30d5\u30a3\u30fc\u30eb\u753b\u50cf\u3084\u30b5\u30e0\u30cd\u30a4\u30eb\u306e\u767b\u9332\u3067\u306f\u5b9a\u756a\u306eUI\u3067\u3059\u3002\u81ea\u524d\u3067\u5b9f\u88c5\u3059\u308b\u3068\u30c9\u30e9\u30c3\u30b0\u51e6\u7406\u30fb\u30ea\u30b5\u30a4\u30ba\u30cf\u30f3\u30c9\u30eb\u30fb\u30a2\u30b9\u30da\u30af\u30c8\u6bd4\u306e\u56fa\u5b9a\u306a\u3069\u3067\u4e00\u6c17\u306b\u8907\u96d1\u306b\u306a\u308a\u307e\u3059\u304c\u3001[Croppe\u2026<\/p>\n","protected":false},"author":1,"featured_media":3780,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_lightning_design_setting":[],"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[36],"tags":[64,55,560,584,1162,101],"class_list":["post-3781","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript-memorandum","tag-api","tag-css","tag-jquery","tag-js","tag-1162","tag-101"],"veu_head_title_object":{"title":"","add_site_title":""},"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2026\/11\/20261024-00mvllyl-thumbnail.jpg","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=3781"}],"version-history":[{"count":1,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3781\/revisions"}],"predecessor-version":[{"id":3782,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3781\/revisions\/3782"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/3780"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=3781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=3781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=3781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}