{"id":28973,"date":"2021-05-31T15:23:00","date_gmt":"2021-05-31T12:23:00","guid":{"rendered":"https:\/\/themewp.inform.click\/?p=28973"},"modified":"2025-02-12T05:54:24","modified_gmt":"2025-02-12T02:54:24","slug":"jak-zavantazhuvati-ta-stiskati-zobrazhennja-v-laravel","status":"publish","type":"post","link":"https:\/\/themewp.inform.click\/uk\/jak-zavantazhuvati-ta-stiskati-zobrazhennja-v-laravel\/","title":{"rendered":"\u042f\u043a \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u0432\u0430\u0442\u0438 \u0442\u0430 \u0441\u0442\u0438\u0441\u043a\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0432 Laravel"},"content":{"rendered":"<p>\u0428\u0443\u043a\u0430\u0454\u0442\u0435, \u044f\u043a \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u0432\u0430\u0442\u0438 \u0442\u0430 \u0441\u0442\u0438\u0441\u043a\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0432 Laravel? Laravel \u0437\u0430\u0431\u0435\u0437\u043f\u0435\u0447\u0443\u0454 \u043f\u0440\u043e\u0441\u0442\u0438\u0439 \u0441\u043f\u043e\u0441\u0456\u0431 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0444\u0430\u0439\u043b\u0456\u0432. \u0410 \u0441\u0442\u0438\u0441\u043d\u0435\u043d\u043d\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u043f\u0456\u0434 \u0447\u0430\u0441 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f &#8211; \u0445\u043e\u0440\u043e\u0448\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430. \u0423 \u0446\u0456\u0439 \u0441\u0442\u0430\u0442\u0442\u0456 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u0432\u0430\u043c, \u044f\u043a \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u0432\u0430\u0442\u0438 \u0442\u0430 \u0441\u0442\u0438\u0441\u043a\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0432 Laravel.<\/p>\n<h3>\u041d\u0430\u0432\u0456\u0449\u043e \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0441\u0442\u0438\u0441\u043a\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f?<\/h3>\n<p>\u0417\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0432\u0456\u0434\u0456\u0433\u0440\u0430\u044e\u0442\u044c \u0432\u0430\u0436\u043b\u0438\u0432\u0443 \u0440\u043e\u043b\u044c \u043d\u0430 \u0432\u0430\u0448\u043e\u043c\u0443 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0456. \u0417\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0434\u043e\u0434\u0430\u044e\u0442\u044c \u043a\u0440\u0430\u0449\u043e\u0433\u043e UX \u0442\u0430 \u043f\u0440\u0438\u0432\u0430\u0431\u043b\u0438\u0432\u043e\u0433\u043e \u0434\u043e\u0441\u0432\u0456\u0434\u0443 \u0434\u043b\u044f \u0432\u0456\u0434\u0432\u0456\u0434\u0443\u0432\u0430\u0447\u0456\u0432. \u0410\u043b\u0435 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0447\u0430\u0441 \u0446\u0435 \u0442\u0430\u043a\u043e\u0436 \u043c\u043e\u0436\u0435 \u0432\u0431\u0438\u0442\u0438 \u0435\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0456\u0441\u0442\u044c \u0441\u0430\u0439\u0442\u0443. \u0412\u0430\u0436\u043a\u0456 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0441\u043f\u043e\u0432\u0456\u043b\u044c\u043d\u044e\u044e\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0443 \u0441\u0430\u0439\u0442\u0443. \u042f\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0432\u0430\u0448 \u0441\u0430\u0439\u0442 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u0454\u0442\u044c\u0441\u044f \u0434\u043e\u0432\u0433\u043e. \u041a\u043e\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0456 \u043d\u0435 \u043b\u044e\u0431\u043b\u044f\u0442\u044c \u043f\u043e\u0432\u0456\u043b\u044c\u043d\u0456 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0438. \u042f\u043a\u0449\u043e \u0434\u043b\u044f \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0432\u0430\u0448\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0443 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0431\u0456\u043b\u044c\u0448\u0435 \u0447\u0430\u0441\u0443, \u0432\u0435\u043b\u0438\u043a\u0430 \u0439\u043c\u043e\u0432\u0456\u0440\u043d\u0456\u0441\u0442\u044c \u0432\u0442\u0440\u0430\u0442\u0438\u0442\u0438 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0456\u044e. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0438\u0439 \u0447\u0430\u0441 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0443 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c 2 \u0441\u0435\u043a\u0443\u043d\u0434\u0438. \u0421\u043b\u0456\u0434 \u043f\u043e\u0434\u0431\u0430\u0442\u0438 \u043f\u0440\u043e \u0442\u0435, \u0449\u043e\u0431 \u0432\u0430\u0448 \u0441\u0430\u0439\u0442 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u0432\u0430\u0432\u0441\u044f \u043f\u0440\u043e\u0442\u044f\u0433\u043e\u043c 2 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<p>\u0425\u043e\u0447\u0430 \u0434\u043b\u044f \u043f\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u044f \u0448\u0432\u0438\u0434\u043a\u043e\u0441\u0442\u0456 \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0438 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0432\u0437\u044f\u0442\u0438 \u0434\u043e \u0443\u0432\u0430\u0433\u0438 \u043a\u0456\u043b\u044c\u043a\u0430 \u0444\u0430\u043a\u0442\u043e\u0440\u0456\u0432, \u043e\u0434\u043d\u0438\u043c \u0456\u0437 \u043d\u0438\u0445 \u0454 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u0430\u043d\u043d\u044f \u043e\u043f\u0442\u0438\u043c\u0456\u0437\u043e\u0432\u0430\u043d\u0438\u0445 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c. \u0421\u0442\u0438\u0441\u043a\u0430\u043d\u043d\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u0437\u043c\u0435\u043d\u0448\u0443\u0454 \u0440\u043e\u0437\u043c\u0456\u0440 \u043e\u0440\u0438\u0433\u0456\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f, \u043d\u0435 \u0432\u0442\u0440\u0430\u0447\u0430\u044e\u0447\u0438 \u043f\u0440\u0438 \u0446\u044c\u043e\u043c\u0443 \u0439\u043e\u0433\u043e \u044f\u043a\u043e\u0441\u0442\u0456. \u0426\u0435 \u0434\u043e\u043f\u043e\u043c\u0430\u0433\u0430\u0454 \u0437\u0431\u0456\u043b\u044c\u0448\u0438\u0442\u0438 \u0448\u0432\u0438\u0434\u043a\u0456\u0441\u0442\u044c \u0441\u0430\u0439\u0442\u0443.<\/p>\n<p>\u0421\u043a\u0430\u0437\u0430\u0432\u0448\u0438 \u0446\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0438\u0432\u0438\u043c\u043e\u0441\u044c, \u044f\u043a \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u0432\u0430\u0442\u0438 \u0442\u0430 \u0441\u0442\u0438\u0441\u043a\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0432 Laravel.<\/p>\n<h3>\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u0443 Laravel<\/h3>\n<p>Laravel \u0437\u0430\u0431\u0435\u0437\u043f\u0435\u0447\u0443\u0454 \u0447\u0438\u0441\u0442\u0438\u0439 \u0441\u043f\u043e\u0441\u0456\u0431 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c. \u0414\u043b\u044f \u043f\u043e\u0447\u0430\u0442\u043a\u0443 \u043d\u0430\u043c \u0441\u043f\u043e\u0447\u0430\u0442\u043a\u0443 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0434\u0435 \u043c\u0438 \u0431\u0443\u0434\u0435\u043c\u043e \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f. \u0412\u0456\u0434\u043a\u0440\u0438\u0439\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0438\u0439 \u0440\u044f\u0434\u043e\u043a \u0443 \u043a\u043e\u0440\u0435\u043d\u0435\u0432\u043e\u043c\u0443 \u043a\u0430\u0442\u0430\u043b\u043e\u0437\u0456 \u0442\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0456\u0442\u044c \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0443 \u043d\u0438\u0436\u0447\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<pre><code>php artisan storage:link<\/code><\/pre>\n<p>\u0426\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u0442\u0432\u043e\u0440\u044e\u0454 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 &quot;\u0437\u0431\u0435\u0440\u0456\u0433\u0430\u043d\u043d\u044f&quot; \u043f\u0456\u0434 \u043f\u0430\u043f\u043a\u043e\u044e &quot;public&quot;.<\/p>\n<p>\u041f\u043e\u0442\u0456\u043c \u0441\u0442\u0432\u043e\u0440\u0456\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u0456\u0437 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044f\u043c \u0444\u0430\u0439\u043b\u0443 \u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u043e\u044e \u043d\u0430\u0434\u0441\u0438\u043b\u0430\u043d\u043d\u044f, \u0434\u043e\u0434\u0430\u0432\u0448\u0438 \u043a\u043e\u0434 \u043d\u0438\u0436\u0447\u0435 \u0443 \u0441\u0432\u0456\u0439 \u0444\u0430\u0439\u043b \u043b\u0435\u0437\u0430.<\/p>\n<pre><code>&lt;form action=\"{{ url('ROUTE_HERE') }}\" method=\"post\" enctype=\"multipart\/form-data\"&gt;\n\u00a0\u00a0\u00a0\u00a0&lt;div class=\"form-group\"&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;label for=\"exampleInputFile\"&gt;File input&lt;\/label&gt;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;input type=\"file\" name=\"profile_image\" id=\"exampleInputFile\"&gt;\n\u00a0\u00a0\u00a0\u00a0&lt;\/div&gt;\n\u00a0\u00a0\u00a0\u00a0{{ csrf_field() }}\n\u00a0\u00a0\u00a0\u00a0&lt;button type=\"submit\" class=\"btn btn-default\"&gt;Submit&lt;\/button&gt;\n&lt;\/form&gt;<\/code><\/pre>\n<p>\u0423 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u043e\u043c\u0443 \u0432\u0438\u0449\u0435 HTML-\u0444\u0430\u0439\u043b\u0456 \u044f \u0434\u043e\u0434\u0430\u0432 \u0444\u0430\u0439\u043b, \u0449\u043e \u0432\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0437 \u043d\u0430\u0437\u0432\u043e\u044e &#8216;profile_image&#8217;. \u042f \u0442\u0430\u043a\u043e\u0436 \u0434\u043e\u0434\u0430\u0432, <code>{{ csrf_field() }}<\/code>\u0449\u043e \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u0430\u043d\u043d\u044f \u0444\u043e\u0440\u043c Laravel.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440, \u043f\u0440\u0438\u043f\u0443\u0441\u043a\u0430\u044e\u0447\u0438, \u0449\u043e \u0432\u0438 \u043d\u0430\u0434\u0441\u0438\u043b\u0430\u0454\u0442\u0435 \u0437\u0430\u043f\u0438\u0442 \u043d\u0430 \u043f\u043e\u0441\u0442 \u0434\u043e <code>store()<\/code>\u043c\u0435\u0442\u043e\u0434\u0443 \u0432\u0430\u0448\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u0440\u0430, \u043d\u0430\u043f\u0438\u0448\u0456\u0442\u044c \u043a\u043e\u0434, \u044f\u043a\u0438\u0439 \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u0454 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0456, \u044f\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0447\u0435.<\/p>\n<pre><code>public function store(Request $request)\n{\n\u00a0\u00a0\u00a0\u00a0if($request-&gt;hasFile('profile_image')) {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/get filename with extension\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$filenamewithextension = $request-&gt;file('profile_image')-&gt;getClientOriginalName();\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/get filename without extension\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$filename = pathinfo($filenamewithextension, PATHINFO_FILENAME);\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/get file extension\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$extension = $request-&gt;file('profile_image')-&gt;getClientOriginalExtension();\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/filename to store\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$filenametostore = $filename.'_'.time().'.'.$extension;\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Upload File\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$request-&gt;file('profile_image')-&gt;storeAs('public\/profile_images', $filenametostore);\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Compress Image Code Here\n\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return redirect('ROUTE_HERE')-&gt;with('success', \"Image uploaded successfully.\");\n\u00a0\u00a0\u00a0\u00a0}\n}<\/code><\/pre>\n<p>\u0426\u0435\u0439 \u043a\u043e\u0434 \u0441\u0442\u0432\u043e\u0440\u044e\u0454 \u0443\u043d\u0456\u043a\u0430\u043b\u044c\u043d\u0435 \u0456\u043c&#8217;\u044f \u0444\u0430\u0439\u043b\u0443 \u0456 \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u0454 \u0444\u0430\u0439\u043b \u0443 \u043a\u0430\u0442\u0430\u043b\u043e\u0437\u0456 &#8216;profile_images&#8217;. Laravel \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0443\u0454 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 &#8216;profile_images&#8217; \u0443 \u0440\u043e\u0437\u0434\u0456\u043b\u0456 &#8216;public \/ storage&#8217;, \u044f\u043a\u0449\u043e \u0432\u0456\u043d \u043d\u0435 \u0456\u0441\u043d\u0443\u0454.<\/p>\n<p>\u042f\u043a \u0443\u0436\u0435 \u0431\u0443\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0440\u0430\u043d\u0456\u0448\u0435, \u0454 \u043a\u0440\u0430\u0449\u043e\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u044e \u043e\u043f\u0442\u0438\u043c\u0456\u0437\u0443\u0432\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u043f\u0456\u0434 \u0447\u0430\u0441 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f. \u041c\u0438 \u0437\u0430\u043a\u0456\u043d\u0447\u0438\u043b\u0438 \u0437 \u043a\u043e\u0434\u043e\u043c \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f. \u0422\u0435\u043f\u0435\u0440 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0439\u043e\u0433\u043e \u0441\u0442\u0438\u0441\u043d\u0443\u0442\u0438. \u042f \u0437\u0431\u0438\u0440\u0430\u044e\u0441\u044f \u043e\u0445\u043e\u043f\u0438\u0442\u0438 2 \u043f\u043e\u0441\u043b\u0443\u0433\u0438 &#8211; <a href=\"https:\/\/tinypng.com\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">TinyPNG<\/a> \u0442\u0430 <a href=\"https:\/\/resmush.it\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">reSmush.it,<\/a> \u044f\u043a\u0456 \u043d\u0430\u0434\u0430\u044e\u0442\u044c API \u0434\u043b\u044f \u0441\u0442\u0438\u0441\u043d\u0435\u043d\u043d\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u043d\u0430 \u043b\u044c\u043e\u0442\u0443. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0431\u0430\u0447\u0438\u043c\u043e \u0457\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443.<\/p>\n<h3>\u0421\u0442\u0438\u0441\u043a\u0430\u0439\u0442\u0435 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e TinyPNG \u0443 Laravel<\/h3>\n<p>\u0429\u043e\u0431 \u0441\u0442\u0438\u0441\u043d\u0443\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e API TinyPNG, \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 <a href=\"https:\/\/tinypng.com\/developers\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u043a\u043b\u044e\u0447 API<\/a>. \u041f\u0440\u043e\u0446\u0435\u0441 \u043f\u0440\u044f\u043c\u0438\u0439. \u0417\u0430\u0440\u0435\u0454\u0441\u0442\u0440\u0443\u0439\u0442\u0435 \u0441\u0432\u043e\u044e \u0435\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \u0443 \u043d\u0438\u0445, \u0456 \u0432\u043e\u043d\u0438 \u043d\u0430\u0434\u0456\u0448\u043b\u044e\u0442\u044c \u0432\u0430\u0448 \u043a\u043b\u044e\u0447 \u0440\u043e\u0437\u0440\u043e\u0431\u043d\u0438\u043a\u0430.<\/p>\n<p>\u041e\u0442\u0440\u0438\u043c\u0430\u0432\u0448\u0438 \u043a\u043b\u044e\u0447 API, \u0434\u043e\u0434\u0430\u0439\u0442\u0435 \u0439\u043e\u0433\u043e \u0443 <code>.env<\/code>\u0444\u0430\u0439\u043b.<\/p>\n<p>\u041f\u0456\u0441\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u0456\u0442\u044c \u043f\u0430\u043a\u0435\u0442 TinyPNG, \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0447\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>composer require tinify\/tinify<\/code><\/pre>\n<p>\u041f\u0456\u0441\u043b\u044f \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u043f\u0430\u043a\u0435\u0442\u0443 \u043c\u0438 \u043f\u043e\u0432\u0438\u043d\u043d\u0456 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u0438 \u043a\u043e\u0434, \u044f\u043a\u0438\u0439 \u0441\u0442\u0438\u0441\u043a\u0430\u0454 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u0435 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e TinyPNG.<\/p>\n<p>\u041d\u0430\u043f\u0438\u0448\u0456\u0442\u044c \u043a\u043e\u0434 \u0441\u0442\u0438\u0441\u043d\u0435\u043d\u043d\u044f \u0442\u0440\u043e\u0445\u0438 \u043d\u0438\u0436\u0447\u0435 \u0440\u044f\u0434\u043a\u0430, \u044f\u043a\u0438\u0439 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u0454 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f.<\/p>\n<pre><code>\/\/Compress Image Code Here\n$filepath = public_path('storage\/profile_images\/'.$filenametostore);\n\u00a0\ntry {\n\u00a0\u00a0\u00a0\u00a0TinifysetKey(env(\"TINIFY_API_KEY\"));\n\u00a0\u00a0\u00a0\u00a0$source = TinifyfromFile($filepath);\n\u00a0\u00a0\u00a0\u00a0$source-&gt;toFile($filepath);\n} catch(TinifyAccountException $e) {\n\u00a0\u00a0\u00a0\u00a0\/\/ Verify your API key and account limit.\n\u00a0\u00a0\u00a0\u00a0return redirect('ROUTE_HERE')-&gt;with('error', $e-&gt;getMessage());\n} catch(TinifyClientException $e) {\n\u00a0\u00a0\u00a0\u00a0\/\/ Check your source image and request options.\n\u00a0\u00a0\u00a0\u00a0return redirect('ROUTE_HERE')-&gt;with('error', $e-&gt;getMessage());\n} catch(TinifyServerException $e) {\n\u00a0\u00a0\u00a0\u00a0\/\/ Temporary issue with the Tinify API.\n\u00a0\u00a0\u00a0\u00a0return redirect('ROUTE_HERE')-&gt;with('error', $e-&gt;getMessage());\n} catch(TinifyConnectionException $e) {\n\u00a0\u00a0\u00a0\u00a0\/\/ A network connection error occurred.\n\u00a0\u00a0\u00a0\u00a0return redirect('ROUTE_HERE')-&gt;with('error', $e-&gt;getMessage());\n} catch(Exception $e) {\n\u00a0\u00a0\u00a0\u00a0\/\/ Something else went wrong, unrelated to the Tinify API.\n\u00a0\u00a0\u00a0\u00a0return redirect('ROUTE_HERE')-&gt;with('error', $e-&gt;getMessage());\n}<\/code><\/pre>\n<p>\u041d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u0432\u0438\u0449\u0435 \u043a\u043e\u0434 \u0431\u0435\u0440\u0435 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0456\u0437 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443, \u0432\u0456\u0434\u043f\u0440\u0430\u0432\u043b\u044f\u0454 \u0439\u043e\u0433\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 TinyPNG \u0434\u043b\u044f \u0441\u0442\u0438\u0441\u043d\u0435\u043d\u043d\u044f \u0456 \u043f\u0456\u0441\u043b\u044f \u043e\u0442\u0440\u0438\u043c\u0430\u043d\u043d\u044f \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u0456 \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u0454 \u0441\u0442\u0438\u0441\u043d\u0435\u043d\u0435 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0432 \u0442\u043e\u043c\u0443 \u0436 \u043a\u0430\u0442\u0430\u043b\u043e\u0437\u0456.<\/p>\n<p>\u0426\u0435\u0439 \u043f\u0440\u043e\u0446\u0435\u0441 \u043f\u0440\u0430\u0446\u044e\u0454 \u0443 \u0444\u043e\u043d\u043e\u0432\u043e\u043c\u0443 \u0440\u0435\u0436\u0438\u043c\u0456. \u0412\u0430\u043c \u043d\u0435 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0442\u0443\u0440\u0431\u0443\u0432\u0430\u0442\u0438\u0441\u044f \u043f\u0440\u043e \u0442\u0435, \u044f\u043a \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u043d\u0430\u0434\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 TinyPNG, \u044f\u043a \u0432\u043e\u043d\u043e \u043e\u0442\u0440\u0438\u043c\u0443\u0454 \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u044c API. \u0411\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0430 TinyPNG \u0432\u0438\u043a\u043e\u043d\u0443\u0454 \u0432\u0441\u0456 \u0437\u0430\u0432\u0434\u0430\u043d\u043d\u044f \u0437\u0430 \u0432\u0430\u0441.<\/p>\n<p>\u0421\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0438\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0437\u0430\u0440\u0430\u0437, \u0456 \u0432\u0438 \u043f\u043e\u0431\u0430\u0447\u0438\u0442\u0435, \u044f\u043a \u0432\u0430\u0448\u0435 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0441\u0442\u0438\u0441\u043a\u0430\u0454\u0442\u044c\u0441\u044f.<\/p>\n<h3>\u0421\u0442\u0438\u0441\u043a\u0430\u0439\u0442\u0435 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e reSmush.it \u0443 Laravel<\/h3>\n<p>TinyPNG \u043f\u0440\u0430\u0446\u044e\u0454 \u0434\u043e\u0431\u0440\u0435, \u0430\u043b\u0435 \u0432\u0456\u043d \u043c\u0430\u0454 \u043e\u0431\u043c\u0435\u0436\u0435\u043d\u043d\u044f \u0449\u043e\u0434\u043e \u043e\u043f\u0442\u0438\u043c\u0456\u0437\u0430\u0446\u0456\u0457 500 \u0431\u0435\u0437\u043a\u043e\u0448\u0442\u043e\u0432\u043d\u0438\u0445 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u043d\u0430 \u043c\u0456\u0441\u044f\u0446\u044c. \u042f\u043a\u0449\u043e \u0432\u0438 \u0445\u043e\u0447\u0435\u0442\u0435 \u0441\u0442\u0438\u0441\u043d\u0443\u0442\u0438 \u0431\u0456\u043b\u044c\u0448\u0435 500 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c, \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u0442\u0438 \u0437\u0430 \u043d\u0438\u0445. \u041a\u0440\u0456\u043c \u0442\u043e\u0433\u043e, \u043a\u043e\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0456 \u043c\u043e\u0436\u0443\u0442\u044c \u0432\u0438\u0431\u0440\u0430\u0442\u0438 \u0431\u0435\u0437\u043a\u043e\u0448\u0442\u043e\u0432\u043d\u0443 \u043f\u043e\u0441\u043b\u0443\u0433\u0443 reSmush.it \u0434\u043b\u044f \u0441\u0442\u0438\u0441\u043d\u0435\u043d\u043d\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f. \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044f \u0446\u0456\u0454\u0457 \u0441\u0442\u0430\u0442\u0442\u0456 reSmush.it \u0441\u0442\u0438\u0441\u043a\u0430\u0454 \u043f\u043e\u043d\u0430\u0434 7 \u043c\u0456\u043b\u044c\u044f\u0440\u0434\u0456\u0432 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c. \u0426\u044c\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043d\u044c\u043e, \u0449\u043e\u0431 \u0441\u043a\u0430\u0437\u0430\u0442\u0438 \u043f\u0440\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0456\u0441\u0442\u044c \u0446\u0456\u0454\u0457 \u043f\u043e\u0441\u043b\u0443\u0433\u0438.<\/p>\n<p>\u041e\u0442\u0436\u0435, \u043d\u0430\u043f\u0438\u0448\u0456\u0442\u044c \u043a\u043e\u0434, \u044f\u043a\u0438\u0439 \u0441\u0442\u0438\u0441\u043a\u0430\u0454 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e reSmush.it \u0443 Laravel.<\/p>\n<pre><code>\/\/Compress Image Code Here\n$filepath = public_path('storage\/profile_images\/'.$filenametostore);\n$mime = mime_content_type($filepath);\n$output = new CURLFile($filepath, $mime, $filenametostore);\n$data = [\"files\" =&gt; $output];\n\u00a0\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'http:\/\/api.resmush.it\/?qlty=80');\ncurl_setopt($ch, CURLOPT_POST,1);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\ncurl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $data);\n$result = curl_exec($ch);\nif (curl_errno($ch)) {\n\u00a0\u00a0\u00a0\u00a0$result = curl_error($ch);\n}\ncurl_close ($ch);\n\u00a0\n$arr_result = json_decode($result);\n\u00a0\n\/\/ store the optimized version of the image\n$ch = curl_init($arr_result-&gt;dest);\n$fp = fopen($filepath, 'wb');\ncurl_setopt($ch, CURLOPT_FILE, $fp);\ncurl_setopt($ch, CURLOPT_HEADER, 0);\ncurl_exec($ch);\ncurl_close($ch);\nfclose($fp);<\/code><\/pre>\n<p>\u042f \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u044f\u043a\u043e\u0441\u0442\u0456 \u044f\u043a 80 <code>?qlty=80<\/code>\u0443 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u043e\u043c\u0443 \u0432\u0438\u0449\u0435 \u043a\u043e\u0434\u0456. \u0412\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0433\u0440\u0430\u0442\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0447\u0438 \u0440\u0456\u0437\u043d\u0456 \u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u044f\u043a\u043e\u0441\u0442\u0456.<\/p>\n<p>\u0421\u043f\u043e\u0434\u0456\u0432\u0430\u044e\u0441\u044f, \u0432\u0438 \u0440\u043e\u0437\u0443\u043c\u0456\u0454\u0442\u0435, \u044f\u043a \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u0432\u0430\u0442\u0438 \u0442\u0430 \u0441\u0442\u0438\u0441\u043a\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0432 Laravel. \u042f \u0445\u043e\u0442\u0456\u0432 \u0431\u0438 \u043f\u043e\u0447\u0443\u0442\u0438 \u0432\u0430\u0448\u0456 \u0434\u0443\u043c\u043a\u0438 \u0442\u0430 \u043f\u0440\u043e\u043f\u043e\u0437\u0438\u0446\u0456\u0457 \u0443 \u0440\u043e\u0437\u0434\u0456\u043b\u0456 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0456\u0432 \u043d\u0438\u0436\u0447\u0435.<\/p>\n<h4>\u0421\u0442\u0430\u0442\u0442\u0456, \u043f\u043e\u0432&#8217;\u044f\u0437\u0430\u043d\u0456 \u0437 \u0446\u0438\u043c<\/h4>\n<ul>\n<li><a href=\"https:\/\/themewp.inform.click\/uk\/tinypng-stysnennia-zobrazhen-za-dopomohoiu-php\/\" title=\"TinyPNG \u0421\u0442\u0438\u0441\u043d\u0435\u043d\u043d\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e PHP\">TinyPNG \u0421\u0442\u0438\u0441\u043d\u0435\u043d\u043d\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e PHP<\/a><\/li>\n<li><a href=\"https:\/\/themewp.inform.click\/uk\/optimizacija-zobrazhen-za-dopomogoju-paketu-artisansweb-image-optimizer\/\" title=\"\u041e\u043f\u0442\u0438\u043c\u0456\u0437\u0430\u0446\u0456\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043f\u0430\u043a\u0435\u0442\u0443 artisansweb \/ image-optimizer\">\u041e\u043f\u0442\u0438\u043c\u0456\u0437\u0430\u0446\u0456\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043f\u0430\u043a\u0435\u0442\u0443 artisansweb \/ image-optimizer<\/a><\/li>\n<li><a href=\"https:\/\/themewp.inform.click\/uk\/zminennja-rozmiru-zobrazhennja-v-php-za-dopomogoju-intervencijnoi-biblioteki-zobrazhen\/\" title=\"\u0417\u043c\u0456\u043d\u0435\u043d\u043d\u044f \u0440\u043e\u0437\u043c\u0456\u0440\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0432 PHP \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u0456\u043d\u0442\u0435\u0440\u0432\u0435\u043d\u0446\u0456\u0439\u043d\u043e\u0457 \u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c\">\u0417\u043c\u0456\u043d\u0435\u043d\u043d\u044f \u0440\u043e\u0437\u043c\u0456\u0440\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0432 PHP \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u0456\u043d\u0442\u0435\u0440\u0432\u0435\u043d\u0446\u0456\u0439\u043d\u043e\u0457 \u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c<\/a><\/li>\n<\/ul>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0414\u0436\u0435\u0440\u0435\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0443: artisansweb.net<\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0438\u0432\u0447\u0438\u043c\u043e, \u044f\u043a \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0443\u0432\u0430\u0442\u0438 \u0442\u0430 \u0441\u0442\u0438\u0441\u043a\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0432 Laravel. \u041c\u0438 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u043c\u043e \u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0443 TinyPNG \u0434\u043b\u044f \u0441\u0442\u0438\u0441\u043d\u0435\u043d\u043d\u044f \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u0438\u0445 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c. \u0422\u0430\u043a\u0438\u043c \u0447\u0438\u043d\u043e\u043c, \u043c\u0438 \u043c\u043e\u0436\u0435\u043c\u043e \u0432\u0434\u043e\u0441\u043a\u043e\u043d\u0430\u043b\u0438\u0442\u0438\u0441\u044c<\/p>\n","protected":false},"author":1,"featured_media":21621,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[212,504],"tags":[851],"class_list":["post-28973","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-elementor-11","category-laravel","tag-affiai-uk"],"_links":{"self":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts\/28973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/comments?post=28973"}],"version-history":[{"count":1,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts\/28973\/revisions"}],"predecessor-version":[{"id":513595,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts\/28973\/revisions\/513595"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/media\/21621"}],"wp:attachment":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/media?parent=28973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/categories?post=28973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/tags?post=28973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}