{"id":5195,"date":"2019-12-04T19:53:50","date_gmt":"2019-12-04T10:53:50","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=5195"},"modified":"2019-12-04T19:53:50","modified_gmt":"2019-12-04T10:53:50","slug":"%e3%82%b5%e3%82%a4%e3%83%88%e3%82%92%e8%bb%bd%e9%87%8f%e5%8c%96%ef%bc%81laravel%e3%81%a7webp%e5%bd%a2%e5%bc%8f%e3%81%ae%e7%94%bb%e5%83%8f%e3%82%92%e3%81%a4%e3%81%8f%e3%82%8b%ef%bc%86%e4%bd%bf%e3%81%86","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=5195","title":{"rendered":"\u30b5\u30a4\u30c8\u3092\u8efd\u91cf\u5316\uff01Laravel\u3067webp\u5f62\u5f0f\u306e\u753b\u50cf\u3092\u3064\u304f\u308b\uff06\u4f7f\u3046"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u7a81\u7136\u3067\u3059\u304c\u307f\u306a\u3055\u3093<strong>\u300cwebp\uff08\u3046\u3047\u3063\u3074\u30fc\uff09\u300d<\/strong>\u3063\u3066\u805e\u3044\u305f\u3053\u3068\u3042\u308b\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p><code>webp<\/code>\u3068\u306f\u3001\u8efd\u91cf\u306e\u65b0\u753b\u50cf\u5f62\u5f0f\uff08<code>jpeg<\/code>\u3084<code>png<\/code>\u306a\u3069\u306e\u4ef2\u9593\uff09\u306e\u3053\u3068\u3067\u3001\u306a\u3093\u3068\u3001\u958b\u767a\u3057\u305f\u30b0\u30fc\u30b0\u30eb\u306b\u3088\u308b\u3068\u3001\u53ef\u9006\u5f62\u5f0f\u3067\u306f<code>png<\/code>\u306e<code>26%<\/code>\u3001\u4e0d\u53ef\u9006\u5f62\u5f0f\u3067\u306f<code>25\u301c34%<\/code>\u3082\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u3092\u6e1b\u3089\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3068<a href=\"https:\/\/developers.google.com\/speed\/webp\/?csw=1\" target=\"_blank\" rel=\"noopener noreferrer\">\u7d39\u4ecb\u3055\u308c\u3066\u3044\u307e\u3059<\/a>\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u305f\u304f\u3055\u3093\u753b\u50cf\u3092\u4f7f\u3046\u30b5\u30a4\u30c8\u3067\u306f\u9ad8\u901f\u5316\u306e\u305f\u3081\u306b<code>webp<\/code>\u3092\u4f7f\u3046\u3053\u3068\u304c\u6709\u52b9\u3068\u3044\u3063\u3066\u3044\u3044\u3093\u3067\u3059\u304c\u3001\u5b9f\u306f\u305d\u308c\u307b\u3069\u666e\u53ca\u3057\u3066\u3044\u308b\u30a4\u30e1\u30fc\u30b8\u306f\u306a\u304b\u3063\u305f\u308a\u3082\u3057\u307e\u3059\u3002<\/p>\n<p>\u306a\u305c\u304b\u3068\u3044\u3046\u3068\u3001<a href=\"https:\/\/caniuse.com\/#search=webp\" target=\"_blank\" rel=\"noopener noreferrer\">Can I use<\/a>\u3092\u898b\u3066\u3082\u3089\u3048\u3070\u5206\u304b\u308a\u3084\u3059\u3044\u3067\u3059\u304c<code>IE<\/code>\u3068<code>Safari<\/code>\u304c<code>webp<\/code>\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u306a\u3044\u304b\u3089\u306a\u3093\u3067\u3059\u306d\uff08\u3046\u30fc\u3093\u3001\u5927\u4eba\u306e\u4e8b\u60c5\u3082\u304b\u3089\u3093\u3067\u3044\u305d\u3046\u3067\u3059\u306d\u30fb\u30fb\u30fb\ud83d\ude2b\uff09<\/p>\n<p>\u305f\u3060\u3001\u305d\u308c\u3067\u3082\u30d6\u30e9\u30a6\u30b6\u306e\u30b7\u30a7\u30a2\u3092\u8003\u3048\u308b\u3068<code>Google Chrome<\/code>\u304c\u5727\u5012\u7684\u306a\u306e\u3067\u3001\u753b\u50cf\u3092\u30e1\u30a4\u30f3\u306b\u3057\u3066\u3044\u308b\u30b5\u30a4\u30c8\u3060\u3068\u30d6\u30e9\u30a6\u30b6\u306b\u3088\u3063\u3066<code>webp<\/code>\u3068<code>JPEG<\/code>\u306a\u3069\u305d\u306e\u4ed6\u306e\u753b\u50cf\u5f62\u5f0f\u3092\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u3067\u3001\u30b5\u30a4\u30c8\u306e\u9ad8\u901f\u5316\u3068\u8ca0\u8377\u8efd\u6e1b\u3092\u5b9f\u73fe\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\uff01<\/p>\n<p>\u4eca\u56de\u306f\u3001<code>Laravel<\/code>\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u305f\u753b\u50cf\u304b\u3089<code>webp<\/code>\u3068<code>jpeg<\/code>\u5f62\u5f0f\u306e\uff12\u753b\u50cf\u3092\u3064\u304f\u308a\u3001\u30d6\u30e9\u30a6\u30b6\u306b\u3088\u3063\u3066\u81ea\u52d5\u7684\u306b\u5207\u308a\u66ff\u3048\u3092\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2173 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/no_24.png\" alt=\"\" width=\"300\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/no_24.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/no_24-281x300.png 281w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 6.x\u3001Vue 2.6<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>GD\u3092\u4f7f\u3046\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b<code>webp<\/code>\u304c\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u3068\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\uff08<code>PHP 5.5<\/code>\u4ee5\u4e0a\u304b<code>7<\/code>\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5196\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/webp_1.png\" alt=\"\" width=\"968\" height=\"511\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/webp_1.png 968w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/webp_1-300x158.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/webp_1-768x405.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Imagemagick<\/code>\u306e\u5834\u5408\u306f<code>libwebp<\/code>\u304c\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h1>\u753b\u50cf\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p>\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304f\u524d\u306b\u3001<code>PHP<\/code>\u3067\u753b\u50cf\u3092\u7c21\u5358\u306b\u64cd\u4f5c\u3067\u304d\u308b\u6709\u540d\u30d1\u30c3\u30b1\u30fc\u30b8<code>intervention<\/code>\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>composer require intervention\/image<\/strong><\/pre>\n<p>\u203b \u306a\u304a\u3001<code>intervention<\/code>\u306e\u3088\u308a\u8a73\u3057\u3044\u4f7f\u3044\u65b9\u306f<a href=\"https:\/\/blog.capilano-fw.com\/?p=1574\">\u5b8c\u5168\u7db2\u7f85\uff01Intervention Image\uff08PHP\uff09\u3067\u753b\u50cf\u3092\u7de8\u96c6\u3059\u308b\u5168\u5b9f\u4f8b<\/a>\u3092\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>Laravel\u306b\u753b\u50cf\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u6a5f\u80fd\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u3053\u3053\u304b\u3089\u304c\u5b9f\u969b\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u3044\u304f\u4f5c\u696d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h2>\n<p>\u307e\u305a\u306f\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308a\u307e\u3059\u3002<br \/>\n<code>routes\/web.php<\/code>\u3092\u958b\u3044\u3066\u4ee5\u4e0b\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>Route::get('webp\/create', 'WebpController@create');<\/strong>\r\n<strong>Route::post('webp', 'WebpController@store');<\/strong><\/pre>\n<h2>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h2>\n<p>\u7d9a\u3044\u3066\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:controller WebpController<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001<code>app\/Http\/Controllers\/WebpController.php<\/code>\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse Illuminate\\Http\\Request;\r\nuse Illuminate\\Support\\Str;\r\n\r\nclass WebpController extends Controller\r\n{\r\n    public function create() {\r\n\r\n        return view('webp\/create');\r\n\r\n    }\r\n\r\n    <strong>public function store(Request $request) {<\/strong>\r\n\r\n<strong>        $result = false;<\/strong>\r\n\r\n<strong>        if($request-&gt;hasFile('image')) {<\/strong>\r\n\r\n<strong>            $path = $request-&gt;image-&gt;path();<\/strong>\r\n<strong>            $image = \\Image::make($path);<\/strong>\r\n<strong>            $uuid = Str::uuid();<\/strong>\r\n\r\n<strong>            \/\/ Webp\u3092\u4f5c\u6210<\/strong>\r\n<strong>            $webp_path = public_path('images\/webp\/'. $uuid .'.webp');<\/strong>\r\n<strong>            $image-&gt;save($webp_path);<\/strong>\r\n\r\n<strong>            \/\/ JPEG\u3092\u4f5c\u6210<\/strong>\r\n<strong>            $jpeg_path = public_path('images\/jpeg\/'. $uuid .'.jpg');<\/strong>\r\n<strong>            $image-&gt;save($jpeg_path);<\/strong>\r\n\r\n<strong>            $result = true;<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        return ['result' =&gt; $result];<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n}<\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u91cd\u8981\u306a\u306e\u304c<code>store()<\/code>\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u306f<code>Ajax<\/code>\u3092\u901a\u3057\u3066\u9001\u4fe1\u3055\u308c\u3066\u304f\u308b\u753b\u50cf\u3092\u53d6\u5f97\u3057\u3001\u305d\u308c\u305e\u308c<code>webp<\/code>\u3068<code>jpeg<\/code>\u5f62\u5f0f\u306e\u753b\u50cf\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u4fdd\u5b58\u3055\u308c\u308b\u30d5\u30a9\u30eb\u30c0\u306f<code>public\/images\/webp<\/code>\u3068<code>public\/images\/jpeg<\/code>\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u30c6\u30b9\u30c8\u306a\u306e\u3067\u3053\u308c\u3089\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u306f<code>777<\/code>\uff08\u5168\u3066OK\uff09\u306e\u6a29\u9650\u3092\u4e0e\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u3053\u308c\u306f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u826f\u3044\u3068\u306f\u3044\u3048\u306a\u3044\u306e\u3067\u3001\u6c17\u306b\u306a\u308b\u65b9\u306f<a href=\"https:\/\/blog.capilano-fw.com\/?p=768#storagelink\" target=\"_blank\" rel=\"noopener noreferrer\">storage\u3092public\u5316<\/a>\u3057\u3066\u304a\u304f\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/p>\n<p>\u203b \u307e\u305f\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3082\u3064\u3044\u3066\u3044\u307e\u305b\u3093\u306e\u3067\u3054\u6ce8\u610f\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u6700\u5f8c\u306b\u753b\u50cf\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a9\u30fc\u30e0\u306e\u30d3\u30e5\u30fc\uff08HTML\uff09\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\n<code>resources\/views\/webp\/create.blade.php<\/code>\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;link href=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.4.1\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body class=\"p-4\"&gt;\r\n    &lt;div id=\"app\" class=\"container\"&gt;\r\n        &lt;div class=\"row\"&gt;\r\n            &lt;div class=\"col-4\"&gt;\r\n                &lt;div class=\"form-group\"&gt;\r\n                    &lt;input class=\"form-control\" type=\"file\" accept=\"image\/*\" <strong>@change=\"onFileChange\"<\/strong>&gt;\r\n                &lt;\/div&gt;\r\n                &lt;button class=\"btn btn-primary\" type=\"button\" <strong>@click=\"onSubmit\"<\/strong>&gt;\u753b\u50cf\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b&lt;\/button&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n    &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue@2.6.0\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/axios\/0.19.0\/axios.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script&gt;\r\n\r\n        new Vue({\r\n            el: '#app',\r\n            data: {\r\n                imageFile: null\r\n            },\r\n            methods: {\r\n                <strong>onFileChange(e) {<\/strong>\r\n\r\n<strong>                    \/\/ \u9078\u629e\u3055\u308c\u305f\u753b\u50cf\u3092\u5909\u6570\u3067\u4fdd\u6301\u3059\u308b<\/strong>\r\n<strong>                    this.imageFile = e.target.files[0];<\/strong>\r\n\r\n<strong>                },<\/strong>\r\n<strong>                onSubmit() {<\/strong>\r\n\r\n<strong>                    \/\/ \u753b\u50cf\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9<\/strong>\r\n<strong>                    const url = '\/webp';<\/strong>\r\n<strong>                    let formData = new FormData();<\/strong>\r\n<strong>                    formData.append('image', this.imageFile);<\/strong>\r\n\r\n<strong>                    axios.post(url, formData)<\/strong>\r\n<strong>                        .then(response =&gt; {<\/strong>\r\n\r\n<strong>                            if(response.data.result) {<\/strong>\r\n\r\n<strong>                                alert('\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002');<\/strong>\r\n\r\n<strong>                            }<\/strong>\r\n\r\n<strong>                        });<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n            }\r\n        });\r\n\r\n    &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u91cd\u8981\u306a\u306e\u306f\u3001\u307e\u305a\u753b\u50cf\u304c\u9078\u629e\u3055\u308c\u305f\u3068\u304d\u306b\u5b9f\u884c\u3055\u308c\u308b<code>onFileChange()<\/code>\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306e\u4e2d\u3067\u306f\u3001\u9078\u629e\u3055\u308c\u305f\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u3044\u3063\u305f\u3093<code>imageFile<\/code>\u3068\u3044\u3046\u5909\u6570\u306e\u4e2d\u306b\u683c\u7d0d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u6b21\u306b<strong>\u300c\u753b\u50cf\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u300d<\/strong>\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3068\u304d\u306b\u5b9f\u884c\u3055\u308c\u308b<code>onSubmit()<\/code>\u3067\u3059\u3002<\/p>\n<p>\u9078\u629e\u3055\u308c\u305f\u753b\u50cf\u306f\u3001<code>axios<\/code>\u3067<code>Ajax<\/code>\u9001\u4fe1\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u901a\u5e38\u306e\u5165\u529b\u5024\u3092\u9001\u4fe1\u3059\u308b\u66f8\u304d\u65b9\u3068\u306f\u9055\u3063\u3066<code>FormData<\/code>\u3092\u4f7f\u3063\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><code>FormData<\/code>\u3078\u306e\u30c7\u30fc\u30bf\u8ffd\u52a0\u306f<code>append()<\/code>\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u9001\u4fe1\u3059\u308b\u3068\u81ea\u52d5\u7684\u306b<code>webp<\/code>\u3068<code>jpeg<\/code>\u753b\u50cf\u304c\u4f5c\u6210\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u304a\u3001<code>webp<\/code>\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u304c\u3069\u308c\u3060\u3051\u5727\u7e2e\u3067\u304d\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u305f\u304b\u3063\u305f\u306e\u3067\u4ee5\u4e0b\u306e<code>png<\/code>\u753b\u50cf\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u8a66\u3057\u3066\u307f\u307e\u3057\u305f<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5197\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/webp_2.png\" alt=\"\" width=\"500\" height=\"510\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/webp_2.png 500w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/webp_2-294x300.png 294w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><br \/>\n\uff08\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u306f\u300192.8 KB\uff09<\/p>\n<p>\u7d50\u679c\u3068\u3057\u3066\u306f\u3001<\/p>\n<ul>\n<li>jpeg\u3000\u30fb\u30fb\u30fb\u300058.5 KB<\/li>\n<li>webp\u3000\u30fb\u30fb\u30fb\u300029.4 KB<\/li>\n<\/ul>\n<p>\u3068\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u3093\u3068\u3001<code>Webp<\/code>\u306e\u65b9\u306f<code>JPEG<\/code>\u30d5\u30a1\u30a4\u30eb\u306e\u534a\u5206\u307b\u3069\u306e\u30b5\u30a4\u30ba\u3067\u3059\ud83d\ude33<br \/>\n\u3053\u308c\u306f\u9ad8\u901f\u5316\u306b\u306f\u5927\u304d\u306a\u5f71\u97ff\u304c\u3042\u308b\u3068\u601d\u308f\u308c\u307e\u3059\u3002<\/p>\n<h1>webp\u3068jpeg\u3092\u5207\u308a\u66ff\u3048\u3066\u8868\u793a\u3059\u308b<\/h1>\n<p>\u3067\u306f\u3001\u3053\u3053\u304b\u3089\u306f\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u305f\u753b\u50cf\uff08<code>webp<\/code>, <code>jpeg<\/code>\uff09\u3092\u30d6\u30e9\u30a6\u30b6\u306b\u3088\u3063\u3066\u5207\u308a\u66ff\u3048\u3066\u8868\u793a\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h2>HTML 5\u3092\u4f7f\u3046<\/h2>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b<code>HTML 5<\/code>\u306e<code>&lt;picture&gt;<\/code>\u30bf\u30b0\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u304c<code>webp<\/code>\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u5834\u5408\u306f<code>webp<\/code>\u3092\u3001\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u306f<code>jpeg<\/code>\u306a\u3069\u4ed6\u306e\u5f62\u5f0f\u306e\u753b\u50cf\u3092\u8aad\u307f\u8fbc\u3080\u3068\u3044\u3046\u3088\u3046\u306b\u81ea\u52d5\u7684\u306b\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><strong>&lt;picture&gt;<\/strong>\r\n    &lt;!-- Webp\u306eURL --&gt;\r\n    <strong>&lt;source type=\"image\/webp\" srcset=\"\/images\/webp\/*****.webp\"&gt;<\/strong>\r\n    &lt;!-- Jpeg\u306eURL --&gt;\r\n    <strong>&lt;img src=\"\/images\/jpeg\/*****.jpg\"&gt;<\/strong>\r\n<strong>&lt;\/picture&gt;<\/strong><\/pre>\n<h2>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u308b<\/h2>\n<p>\u305f\u3060\u3057\u3001\u6bce\u56de\u6bce\u56de\u5148\u307b\u3069\u306e\u30bf\u30b0\u3092\u4f5c\u6210\u3059\u308b\u306e\u306f\u9762\u5012\u3060\u3063\u305f\u308a\u3057\u307e\u3059\u3002<br \/>\n\u305d\u3053\u3067\u3001\u6b21\u306e\u3088\u3046\u306a\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u3063\u3066\u304a\u304f\u3068\u4fbf\u5229\u3067\u3057\u3087\u3046\u3002<\/p>\n<h3>Blade\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/h3>\n<p><code>resources\/views\/components\/webp.blade.php<\/code>\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>&lt;picture&gt;<\/strong>\r\n<strong>    &lt;source type=\"image\/webp\" srcset=\"{{ $src }}\"&gt;<\/strong>\r\n<strong>    &lt;img src=\"{{ $alt }}\"&gt;<\/strong>\r\n<strong>&lt;\/picture&gt;<\/strong><\/pre>\n<p>\u4f7f\u3044\u65b9\u306f\u3053\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>@component('components.webp')<\/strong>\r\n<strong>    @slot('src', '\/images\/webp\/*****.webp')<\/strong>\r\n<strong>    @slot('alt', '\/images\/jpeg\/*****.jpg')<\/strong>\r\n<strong>@endcomponent<\/strong><\/pre>\n<h3>Vue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/h3>\n<p>Vue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u5834\u5408\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>Vue.component('v-webp', {<\/strong>\r\n<strong>    props: ['src', 'alt'],<\/strong>\r\n<strong>    template: '&lt;picture&gt;'+<\/strong>\r\n<strong>        '&lt;source type=\"image\/webp\" :srcset=\"src\"&gt;'+<\/strong>\r\n<strong>        '&lt;img :src=\"alt\"&gt;'+<\/strong>\r\n<strong>        '&lt;\/picture&gt;'<\/strong>\r\n<strong>});<\/strong><\/pre>\n<p>\u4f7f\u3044\u65b9\u306f\u3053\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>&lt;v-webp<\/strong>\r\n<strong>    src=\"\/images\/webp\/*****.webp\"<\/strong>\r\n<strong>    alt=\"\/images\/jpeg\/*****.jpg\"&gt;&lt;\/v-webp&gt;<\/strong><\/pre>\n<p>\u3053\u308c\u3067\u81ea\u52d5\u5207\u308a\u66ff\u3048\u304c\u7c21\u5358\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\ud83d\ude0a\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u4eca\u56de\u306f\u8efd\u91cf\u306a\u753b\u50cf\u5f62\u5f0f\u306e<code>webp<\/code>\u3092\u3064\u304f\u308b\uff06\u4f7f\u3046\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u304c\u3001\u5b9f\u969b\u306b<code>webp<\/code>\u306e\u753b\u50cf\u304c\u3044\u304b\u306b\u8efd\u91cf\u306b\u306a\u308b\u304b\u3092\u77e5\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3001<code>webp<\/code>\u306f\u307e\u3060\u307e\u3060\u30e1\u30b8\u30e3\u30fc\u306b\u306a\u308b\u306b\u306f\u9053\u534a\u3070\u3067\u3001<code>windows 10<\/code>\uff06<code>Ubuntu 18.04<\/code>\u3067\u78ba\u8a8d\u3057\u307e\u3057\u305f\u304c\u3001\u901a\u5e38\u306e\u753b\u50cf\u30bd\u30d5\u30c8\u3067\u306f\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u305a<code>Google Chrome<\/code>\u3067\u958b\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u4e0a\u306b\u306f<strong>\u300cwebp\u3092jpeg\u306b\u5909\u63db\u3059\u308b\u300d<\/strong>\u3068\u3044\u3046\u30aa\u30f3\u30e9\u30a4\u30f3\u30fb\u30b5\u30fc\u30d3\u30b9\u3082\u3042\u3063\u305f\u308a\u3059\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u3068\u306f\u3044\u3063\u3066\u3082\u3001\u30d5\u30ea\u30fc\u306e\u753b\u50cf\u30bd\u30d5\u30c8<code>Gimp<\/code>\u304c<code>webp<\/code>\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u305f\u3068\u3044\u3046\u52d5\u304d\u3082\u3042\u308a\u307e\u3059\u3057\u3001\u306a\u306b\u3088\u308a<code>Google<\/code>\u304c\u958b\u767a\u3057\u305f\u3068\u3044\u3046\u306e\u306f\u5927\u304d\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\uff08\u305f\u307e\u306b<code>Google<\/code>\u306f\u300c\u306f\u3044\u3001\u3084\u3081\u307e\u30fc\u3059\u266a\u300d\u3063\u3066\u306a\u308b\u306e\u3082\u4e8b\u5b9f\u3067\u3059\u304c\ud83d\ude02\uff09<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u30da\u30fc\u30b8\u306e\u9ad8\u901f\u8868\u793a\u306e\u305f\u3081\u306b<code>webp<\/code>\u3082\u691c\u8a0e\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u266a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-461 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/38.png\" alt=\"\" width=\"294\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/38.png 294w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/38-276x300.png 276w\" sizes=\"auto, (max-width: 294px) 100vw, 294px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u7a81\u7136\u3067\u3059\u304c\u307f\u306a\u3055\u3093\u300cwebp\uff08\u3046\u3047\u3063\u3074\u30fc\uff09\u300d\u3063\u3066\u805e\u3044\u305f\u3053\u3068\u3042\u308b\u3067\u3057\u3087\u3046\u304b\u3002 webp\u3068\u306f\u3001\u8efd\u91cf\u306e\u65b0\u753b\u50cf\u5f62\u5f0f\uff08jpeg\u3084png\u306a\u3069\u306e\u4ef2\u9593\uff09\u306e\u3053\u3068\u3067\u3001\u306a\u3093 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=5195\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u30b5\u30a4\u30c8\u3092\u8efd\u91cf\u5316\uff01Laravel\u3067webp\u5f62\u5f0f\u306e\u753b\u50cf\u3092\u3064\u304f\u308b\uff06\u4f7f\u3046&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":5200,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[190,83],"class_list":["post-5195","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-webp","tag-83"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5195"}],"version-history":[{"count":4,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5195\/revisions"}],"predecessor-version":[{"id":5202,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5195\/revisions\/5202"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/5200"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}