{"id":230392,"date":"2022-12-02T18:21:00","date_gmt":"2022-12-02T15:21:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=230392"},"modified":"2022-11-09T22:11:23","modified_gmt":"2022-11-09T19:11:23","slug":"programna-zmina-rozmiru-zobrazhen-u-wordpress","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/uk\/programna-zmina-rozmiru-zobrazhen-u-wordpress\/","title":{"rendered":"\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043d\u0430 \u0437\u043c\u0456\u043d\u0430 \u0440\u043e\u0437\u043c\u0456\u0440\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u0443 WordPress"},"content":{"rendered":"\n<p>\u042f\u043a\u0449\u043e \u0432\u0430\u043c \u043a\u043e\u043b\u0438-\u043d\u0435\u0431\u0443\u0434\u044c \u0434\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044f \u043f\u0440\u0430\u0446\u044e\u0432\u0430\u0442\u0438 \u0437\u0456 \u0437\u043c\u0456\u043d\u043e\u044e \u0440\u043e\u0437\u043c\u0456\u0440\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043d\u0438\u043c \u0448\u043b\u044f\u0445\u043e\u043c \u0443 WordPress, \u043c\u043e\u0436\u043b\u0438\u0432\u043e, \u0432\u0438 \u0441\u0442\u0438\u043a\u0430\u043b\u0438\u0441\u044f \u0437 \u0444\u0443\u043d\u043a\u0446\u0456\u0454\u044e <strong><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/image_resize\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">image_resize<\/a><\/strong>.<\/p>\n<p>\u041a\u0440\u0456\u043c \u0442\u043e\u0433\u043e, \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u043d\u0430\u0442\u0438, \u0449\u043e \u0439\u043e\u0433\u043e \u043d\u0435 \u043f\u0456\u0434\u0442\u0440\u0438\u043c\u0443\u0454\u043c\u043e (\u0432\u0440\u0430\u0445\u043e\u0432\u0443\u044e\u0447\u0438, \u0449\u043e \u0446\u0435 \u0432\u0456\u0434\u043e\u0431\u0440\u0430\u0436\u0430\u0454\u0442\u044c\u0441\u044f \u0443 \u0432\u0435\u0440\u0445\u043d\u0456\u0439 \u0447\u0430\u0441\u0442\u0438\u043d\u0456 \u0435\u043a\u0440\u0430\u043d\u0430):<\/p>\n<blockquote>\n<p>\u0426\u044f \u0444\u0443\u043d\u043a\u0446\u0456\u044f \u0437\u0430\u0441\u0442\u0430\u0440\u0456\u043b\u0430. \u041d\u0430\u0442\u043e\u043c\u0456\u0441\u0442\u044c \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0439\u0442\u0435 <strong><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_get_image_editor\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">wp_get_image_editor()<\/a><\/strong>.<\/p>\n<\/blockquote>\n<p>\u0406 \u0437 \u0439\u043e\u0433\u043e \u043f\u0440\u0438\u043f\u0438\u043d\u0435\u043d\u043d\u044f\u043c, \u044f\u043a \u0456 \u0434\u043b\u044f \u0432\u0441\u0456\u0445 \u0442\u0438\u0445, \u0445\u0442\u043e \u0434\u043e\u0431\u0440\u0435 \u043f\u0440\u0430\u0446\u044e\u0454 \u043d\u0430\u0434 \u043f\u0440\u0438\u043f\u0438\u043d\u0435\u043d\u043d\u044f\u043c \u0444\u0443\u043d\u043a\u0446\u0456\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0456, \u043d\u0435 \u043e\u0431\u0456\u0439\u0434\u0435\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u0439\u043e\u0433\u043e \u0437\u0430\u043c\u0456\u043d\u0438.<\/p>\n<p>\u0423 \u0446\u044c\u043e\u043c\u0443 \u0432\u0438\u043f\u0430\u0434\u043a\u0443 \u043c\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043c\u043e \u043f\u0440\u043e WP Image Editor. \u0426\u0435 \u043a\u043b\u0430\u0441 \u0443 WordPress, \u044f\u043a\u0438\u0439 \u043c\u0438 \u043c\u043e\u0436\u0435\u043c\u043e \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u0434\u043b\u044f \u0432\u0438\u043a\u043e\u043d\u0430\u043d\u043d\u044f \u0442\u0438\u0445 \u0441\u0430\u043c\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0456\u0439 \u0437\u0456 \u0437\u043c\u0456\u043d\u043e\u044e \u0440\u043e\u0437\u043c\u0456\u0440\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043d\u0438\u043c \u0448\u043b\u044f\u0445\u043e\u043c, \u044f\u043a\u0456 \u043c\u0438 \u043a\u043e\u043b\u0438\u0441\u044c \u043c\u043e\u0433\u043b\u0438 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u0437 \u043e\u0440\u0438\u0433\u0456\u043d\u0430\u043b\u044c\u043d\u043e\u044e \u0444\u0443\u043d\u043a\u0446\u0456\u0454\u044e.<\/p>\n<p>\u0429\u043e\u0431 \u0431\u0443\u043b\u043e \u0437\u0440\u043e\u0437\u0443\u043c\u0456\u043b\u043e, \u0446\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u044f \u043d\u0435 \u0454 \u043f\u043e\u0432\u043d\u0438\u043c \u043f\u043e\u0441\u0456\u0431\u043d\u0438\u043a\u043e\u043c \u0449\u043e\u0434\u043e \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u0430\u043d\u043d\u044f <strong><a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_image_editor\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\"><code>WP_Image_Editor<\/code><\/a><\/strong>.<\/p>\n<\/p>\n<p>\u041d\u0430\u0442\u043e\u043c\u0456\u0441\u0442\u044c \u0446\u0435 \u043f\u0440\u043e\u0441\u0442\u0438\u0439 \u043f\u043e\u0441\u0456\u0431\u043d\u0438\u043a \u0449\u043e\u0434\u043e \u0442\u043e\u0433\u043e, \u044f\u043a \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u0439\u043e\u0433\u043e \u0434\u043b\u044f \u0437\u043c\u0456\u043d\u0438 \u0440\u043e\u0437\u043c\u0456\u0440\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c \u0437\u0430\u043c\u0456\u0441\u0442\u044c \u0437\u0430\u0441\u0442\u0430\u0440\u0456\u043b\u043e\u0457 \u0444\u0443\u043d\u043a\u0446\u0456\u0457 \u0440\u0430\u0437\u043e\u043c \u0456\u0437 \u0434\u0435\u044f\u043a\u0438\u043c\u0438 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u043d\u044f\u043c\u0438 \u0449\u043e\u0434\u043e \u0442\u043e\u0433\u043e, \u044f\u043a \u043f\u043e\u0432\u043e\u0434\u0438\u0442\u0438\u0441\u044f \u0437 \u0432\u0438\u043f\u0430\u0434\u043a\u0430\u043c\u0438, \u043a\u043e\u043b\u0438 \u043c\u043e\u0436\u0443\u0442\u044c \u0431\u0443\u0442\u0438 \u043f\u043e\u043c\u0438\u043b\u043a\u0438.<\/p>\n<h3>\u041f\u043e\u0448\u0443\u043a \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0434\u043b\u044f \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u0430\u043d\u043d\u044f<\/h3>\n<p>\u0417\u0430\u043b\u0435\u0436\u043d\u043e \u0432\u0456\u0434 \u0442\u043e\u0433\u043e, \u0449\u043e \u0432\u0438 \u0440\u043e\u0431\u0438\u0442\u0435, \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u043d\u0430\u0437\u0432\u0443 \u0444\u0430\u0439\u043b\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u0437 \u0441\u0430\u043c\u043e\u0433\u043e WordPress; \u043e\u0434\u043d\u0430\u043a \u0434\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u0443 \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0443\u044e \u0448\u043b\u044f\u0445 \u0434\u043e \u0444\u0430\u0439\u043b\u0443.<\/p>\n<p>\u0426\u0435 \u043d\u0430\u0439\u043f\u0440\u043e\u0441\u0442\u0456\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u0456\u0431 \u043f\u043e\u044f\u0441\u043d\u0438\u0442\u0438, \u044f\u043a \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u043a\u043b\u0430\u0441 \u0437\u0430\u043c\u0456\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0443 \u043f\u043e \u0434\u043e\u0442\u0438\u0447\u043d\u0456\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u044f\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043d\u043e \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f, \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u0439\u043e\u0433\u043e \u0448\u043b\u044f\u0445, \u043d\u0430\u0434\u0456\u0441\u043b\u0430\u0442\u0438 \u0439\u043e\u0433\u043e \u0434\u043e \u043a\u043b\u0430\u0441\u0443 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0442\u043e\u0449\u043e.<\/p>\n<p>\u0422\u043e\u0436 \u043f\u0440\u0438\u043f\u0443\u0441\u0442\u0456\u043c\u043e, \u0449\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u0448\u043b\u044f\u0445 \u0434\u043e \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/96fa8bb3af0ee6fd821b3899e82d5fdb#file-00-filename-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u043f\u0440\u0438\u0431\u043b\u0438\u0437\u043d\u043e \u0442\u0430\u043a\u0438\u0439:<\/a><\/strong><\/p>\n<pre><code>&lt;?php\n\n$filename = '\/Users\/tommcfarlin\/Projects\/acme\/wp-content\/uploads\/2018\/06\/original-image.jpg';\nif (!file_exists($filename)) {\n  return;\n}<\/code><\/pre>\n<p>\u0412\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0447\u0438 \u0446\u0435, \u043c\u0438 \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043c\u043e \u0439\u043e\u0433\u043e \u0432 \u0437\u043c\u0456\u043d\u043d\u0456\u0439, \u044f\u043a\u0443 \u043c\u0438 \u043c\u043e\u0436\u0435\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0438 \u0432 \u0456\u043d\u0448\u0443 \u0444\u0443\u043d\u043a\u0446\u0456\u044e, \u044f\u043a\u0449\u043e \u043c\u0438 \u0445\u043e\u0447\u0435\u043c\u043e \u043e\u043f\u0435\u0440\u0443\u0432\u0430\u0442\u0438 \u0437 \u0432\u0438\u0445\u0456\u0434\u043d\u0438\u043c \u0444\u0430\u0439\u043b\u043e\u043c \u043a\u0456\u043b\u044c\u043a\u0430 \u0440\u0430\u0437\u0456\u0432.<\/p>\n<h3>\u041e\u0442\u0440\u0438\u043c\u0430\u043d\u043d\u044f \u0435\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c<\/h3>\n<p>\u0414\u0430\u043b\u0456 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u0435\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0443 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c, \u0449\u043e\u0431 \u0432\u0438 \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u0430\u0446\u044e\u0432\u0430\u0442\u0438 \u0456\u0437 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f\u043c, \u0440\u043e\u0437\u0442\u0430\u0448\u043e\u0432\u0430\u043d\u0438\u043c \u043d\u0430 \u0448\u043b\u044f\u0445\u0443 \u0432\u0438\u0449\u0435. \u0423 \u043d\u0430\u0439\u043f\u0440\u043e\u0441\u0442\u0456\u0448\u0456\u0439 \u0444\u043e\u0440\u043c\u0456 \u0446\u0435 \u043d\u0435 \u0449\u043e \u0456\u043d\u0448\u0435, \u044f\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0456\u043c\u0435\u043d\u0456 \u0444\u0430\u0439\u043b\u0443 \u0443 \u0444\u0443\u043d\u043a\u0446\u0456\u044e, \u0430 \u043f\u043e\u0442\u0456\u043c \u043c\u0430\u0441\u0438\u0432\u0443 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0456\u0432.<\/p>\n<p>\u0423 \u0446\u0456\u0439 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457 \u043c\u0435\u043d\u0435 \u043d\u0435 \u0445\u0432\u0438\u043b\u044e\u0454 \u043c\u0430\u0441\u0438\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0456\u0432 \u2013 \u043b\u0438\u0448\u0435 \u043e\u0442\u0440\u0438\u043c\u0430\u043d\u043d\u044f \u0435\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430, \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u044f\u043a\u043e\u0433\u043e \u044f \u043c\u043e\u0436\u0443 \u0437\u043c\u0456\u043d\u0438\u0442\u0438 \u0440\u043e\u0437\u043c\u0456\u0440 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f.<\/p>\n<p>\u0429\u043e\u0431 \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u0435\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0437\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430, <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/96fa8bb3af0ee6fd821b3899e82d5fdb#file-01-get-editor-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0440\u043e\u0431\u0456\u0442\u044c \u0446\u0435:<\/a><\/strong><\/p>\n<pre><code>&lt;?php\n\n\/\/ Grab the editor for the filename of the image. \n$filename = '\/Users\/tommcfarlin\/Projects\/acme\/wp-content\/uploads\/2018\/06\/original-image.jpg';\nif (!file_exists($filename)) {\n  return;\n}\n\n$editor = wp_get_image_editor( $filename, array() );<\/code><\/pre>\n<p>\u0426\u0435 \u043f\u043e\u0432\u0435\u0440\u043d\u0435 \u0430\u0431\u043e \u0435\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0435\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 <code>**[WP_Error](https:\/\/developer.wordpress.org\/reference\/classes\/wp_error\/)**<\/code>(\u0440\u0430\u0437\u043e\u043c \u0456\u0437 \u043f\u043e\u0432\u0456\u0434\u043e\u043c\u043b\u0435\u043d\u043d\u044f\u043c \u043f\u0440\u043e \u043f\u043e\u043c\u0438\u043b\u043a\u0443 \u0442\u0430 \u0456\u043d\u0448\u043e\u044e \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u0454\u044e, \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u044f\u043a\u043e\u0457 \u043c\u043e\u0436\u043d\u0430 \u0432\u0438\u0437\u043d\u0430\u0447\u0438\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443). \u0417\u0430\u0432\u0436\u0434\u0438 \u043a\u043e\u0440\u0438\u0441\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0456\u0440\u0438\u0442\u0438, \u0447\u0438 \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u0454 \u043f\u043e\u043c\u0438\u043b\u043a\u043e\u044e, \u0456 <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/96fa8bb3af0ee6fd821b3899e82d5fdb#file-02-check-for-errors-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0437\u0443\u043f\u0438\u043d\u0438\u0442\u0438 \u0431\u0443\u0434\u044c-\u044f\u043a\u0456 \u043c\u0430\u0439\u0431\u0443\u0442\u043d\u0456 \u043e\u043f\u0435\u0440\u0430\u0446\u0456\u0457.<\/a><\/strong><\/p>\n<pre><code>&lt;?php\n\n\/\/ Grab the editor for the file and the size of the original image.\n$filename = '\/Users\/tommcfarlin\/Projects\/acme\/wp-content\/uploads\/2018\/06\/original-image.jpg';\nif (!file_exists($filename)) {\n  return;\n}\n\n$editor = wp_get_image_editor( $filename, array() );\nif (is_wp_error($editor)) {\n   \/\/ handle the problem however you deem necessary.\n}<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a \u043f\u0440\u0438\u043f\u0443\u0441\u0442\u0438\u0432\u0448\u0438, \u0449\u043e \u043f\u043e\u043c\u0438\u043b\u043a\u0438 \u043d\u0435\u043c\u0430\u0454, \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0447\u0430\u0442\u0438 \u043f\u0440\u0430\u0446\u044e\u0432\u0430\u0442\u0438 \u043d\u0430\u0434 \u0437\u043c\u0456\u043d\u043e\u044e \u0440\u043e\u0437\u043c\u0456\u0440\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f.<\/p>\n<h3>\u0417\u043c\u0456\u043d\u0430 \u0440\u043e\u0437\u043c\u0456\u0440\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f<\/h3>\n<p>\u041d\u0430 \u0449\u0430\u0441\u0442\u044f, \u0446\u0435 \u0442\u0435, \u0449\u043e \u043b\u0435\u0433\u043a\u043e \u0437\u0440\u043e\u0431\u0438\u0442\u0438. \u0412\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u0456 \u0442\u0440\u0438 \u0432\u0456\u0434\u043e\u043c\u043e\u0441\u0442\u0456:<\/p>\n<ol>\n<li>\u0448\u0438\u0440\u0438\u043d\u0430,<\/li>\n<li>\u0432\u0438\u0441\u043e\u0442\u0430,<\/li>\n<li>\u0456 \u0447\u0438 \u0431\u0430\u0436\u0430\u0454\u0442\u0435 \u0432\u0438 \u043e\u0431\u0440\u0456\u0437\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f.<\/li>\n<\/ol>\n<p>\u0417 \u043c\u043e\u0433\u043e \u0434\u043e\u0441\u0432\u0456\u0434\u0443, \u043e\u0431\u0440\u0456\u0437\u0430\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u043c\u0430\u0439\u0436\u0435 \u0437\u0430\u0432\u0436\u0434\u0438 \u043a\u0440\u0430\u0449\u0435, \u043d\u0456\u0436 \u043d\u0456, \u0442\u043e\u043c\u0443 \u0449\u043e \u0446\u0435 \u0434\u043e\u0437\u0432\u043e\u043b\u044f\u0454 \u0443\u043d\u0438\u043a\u043d\u0443\u0442\u0438 \u0431\u0443\u0434\u044c-\u044f\u043a\u043e\u0433\u043e \u0434\u0438\u0432\u043d\u043e\u0433\u043e \u0440\u043e\u0437\u0442\u044f\u0433\u0443\u0432\u0430\u043d\u043d\u044f \u0430\u0431\u043e \u0441\u043f\u043e\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u0437\u0430 \u043d\u0435\u0437\u0432\u0438\u0447\u0430\u0439\u043d\u0438\u0445 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0456\u0439.<\/p>\n<p>\u041f\u0456\u0434 \u0447\u0430\u0441 \u0437\u043c\u0456\u043d\u0438 \u0440\u043e\u0437\u043c\u0456\u0440\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u044f \u0437\u0430\u0432\u0436\u0434\u0438 \u0445\u043e\u0447\u0443 \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u043f\u043e\u0442\u043e\u0447\u043d\u0438\u0439 \u0440\u043e\u0437\u043c\u0456\u0440 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f, \u0430 \u043f\u043e\u0442\u0456\u043c \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u043c\u043d\u043e\u0436\u043d\u0438\u043a \u0434\u043b\u044f \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u043d\u043e\u0432\u0438\u0445 \u0440\u043e\u0437\u043c\u0456\u0440\u0456\u0432, \u0437\u0430 \u044f\u043a\u0438\u043c\u0438 \u044f \u0445\u043e\u0447\u0443 \u0437\u043c\u0456\u043d\u0438\u0442\u0438 \u0440\u043e\u0437\u043c\u0456\u0440 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434, \u0441\u043a\u0430\u0436\u0456\u043c\u043e, \u0443 \u043c\u0435\u043d\u0435 \u0454 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f, \u0456 \u044f \u0445\u043e\u0447\u0443 \u0437\u043c\u0456\u043d\u0438\u0442\u0438 \u0440\u043e\u0437\u043c\u0456\u0440 \u0448\u0438\u0440\u0438\u043d\u0438 \u043d\u0430 40% \u0456 \u0432\u0438\u0441\u043e\u0442\u0438 \u043d\u0430 30%. \u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u043c\u0435\u043d\u0456 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e:<\/p>\n<ol>\n<li>\u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u0440\u043e\u0437\u043c\u0456\u0440 \u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f,<\/li>\n<li>\u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0439\u0442\u0435 \u043d\u043e\u0432\u0456 \u0448\u0438\u0440\u0438\u043d\u0443 \u0442\u0430 \u0432\u0438\u0441\u043e\u0442\u0443, \u0449\u043e\u0431 \u0437\u043c\u0456\u043d\u0438\u0442\u0438 \u0440\u043e\u0437\u043c\u0456\u0440 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f.<\/li>\n<\/ol>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043d\u043e <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/96fa8bb3af0ee6fd821b3899e82d5fdb#file-03-sizing-the-image-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0446\u0435 \u043c\u043e\u0436\u043d\u0430 \u0437\u0440\u043e\u0431\u0438\u0442\u0438 \u0442\u0430\u043a:<\/a><\/strong><\/p>\n<pre><code>&lt;?php\n\n\/\/ Grab the editor for the file and the size of the original image.\n$filename = '\/Users\/tommcfarlin\/Projects\/acme\/wp-content\/uploads\/2018\/06\/original-image.jpg';\nif (!file_exists($filename)) {\n  return;\n}\n\n$editor = wp_get_image_editor( $filename, array() );\nif (is_wp_error($editor)) {\n   \/\/ Handle the problem however you deem necessary.\n}\n\n\/\/ Get the dimensions for the size of the current image.\n$dimensions = $editor-&gt;get_size();\n$width = $dimensions['width'];\n$height = $dimensions['height'];\n\n\/\/ Calculate the new dimensions for the image.\n$newWidth = 0.4 * $width;\n$newHeight = 0.3 * $height;\n\n\/\/ Resize the image.\n$result = $editor-&gt;resize($newWidth, $newHeight, true);<\/code><\/pre>\n<p>\u0414\u043e\u0441\u0438\u0442\u044c \u043b\u0435\u0433\u043a\u043e \u0441\u043b\u0456\u0434\u0443\u0432\u0430\u0442\u0438, \u0447\u0438 \u043d\u0435 \u0442\u0430\u043a?<\/p>\n<h3>\u0417\u0431\u0435\u0440\u0435\u0436\u0435\u043d\u043d\u044f \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f<\/h3>\n<p>\u041d\u0430\u0440\u0435\u0448\u0442\u0456, \u0432\u0441\u0435, \u0449\u043e \u0437\u0430\u043b\u0438\u0448\u0438\u043b\u043e\u0441\u044f, \u0446\u0435 \u0437\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f. \u0423 \u0446\u044c\u043e\u043c\u0443 \u0432\u0438\u043f\u0430\u0434\u043a\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/96fa8bb3af0ee6fd821b3899e82d5fdb#file-04-saving-the-image-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0431\u0443\u0434\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e<\/a><\/strong> \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u044c (\u0456 \u0437\u0430\u0437\u0432\u0438\u0447\u0430\u0439 \u0440\u0456\u043a \u0456 \u043c\u0456\u0441\u044f\u0446\u044c, \u044f\u043a\u0456 \u043d\u0430\u0434\u0430\u0454 WordPress).<\/p>\n<pre><code>&lt;?php\n\n\/\/ Grab the editor for the file and the size of the original image.\n$filename = '\/Users\/tommcfarlin\/Projects\/acme\/wp-content\/uploads\/2018\/06\/original-image.jpg';\nif (!file_exists($filename)) {\n  return;\n}\n\n$editor = wp_get_image_editor( $filename, array() );\nif (is_wp_error($editor)) {\n   \/\/ handle the problem however you deem necessary.\n}\n\n\/\/ Get the dimensions for the size of the current image.\n$dimensions = $editor-&gt;get_size();\n$width = $dimensions['width'];\n$height = $dimensions['height'];\n\n\/\/ Calculate the new dimensions for the image.\n$newWidth = 0.4 * $width;\n$newHeight = 0.3 * $height;\n\n\/\/ Resize the image.\n$result = $editor-&gt;resize($newWidth, $newHeight, true);\n\n\/\/ If there's no problem, save it; otherwise, print the problem.\nif (!is_wp_error($result)) {\n  $editor-&gt;save($editor-&gt;generate_filename());\n} else {\n   \/\/ Handle the problem however you deem necessary.\n}<\/code><\/pre>\n<p>\u041f\u043e\u0442\u0456\u043c \u0432\u0438 \u0437\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0431\u0430\u0447\u0438\u0442\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0443 \u0432\u0435\u0440\u0441\u0456\u044e \u0437\u0456 \u0437\u043c\u0456\u043d\u0435\u043d\u0438\u043c \u0440\u043e\u0437\u043c\u0456\u0440\u043e\u043c (\u0456 \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u043d\u043e\u044e \u043d\u0430\u0437\u0432\u043e\u044e) \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0456 \u0457\u0457 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0414\u0436\u0435\u0440\u0435\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0443:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/tommcfarlin.com\" class=\"external external_icon\">tommcfarlin.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0426\u044f \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u044f \u043c\u0456\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u0443 \u043f\u0440\u043e\u0441\u0442\u0443 \u0456\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0456\u044e \u0449\u043e\u0434\u043e \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u0430\u043d\u043d\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c WP \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043d\u043e\u0457 \u0437\u043c\u0456\u043d\u0438 \u0440\u043e\u0437\u043c\u0456\u0440\u0443 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u044c.<\/p>\n","protected":false},"author":1,"featured_media":163264,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[869,849,725],"tags":[1174],"class_list":["post-230392","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-10","category-pidruchnyky","category-rozrobnyk","tag-affiai-uk"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/230392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/comments?post=230392"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/230392\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media\/163264"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media?parent=230392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/categories?post=230392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/tags?post=230392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}