{"id":4829,"date":"2021-05-28T18:19:14","date_gmt":"2021-05-28T18:19:14","guid":{"rendered":"https:\/\/www.s-sols.com\/?post_type=doc&#038;p=4829"},"modified":"2025-03-19T14:05:33","modified_gmt":"2025-03-19T14:05:33","slug":"settings-images-accel","status":"publish","type":"doc","link":"https:\/\/www.s-sols.com\/docs\/wordpress\/accelerator\/settings-accel\/settings-images-accel","title":{"rendered":"Images settings Accelerator for WordPress"},"content":{"rendered":"<p style=\"text-align:center\">\n  <img decoding=\"async\" src=\"\/data\/content\/doc\/wordpress\/accelerator\/settings-images-accel\/settings-images-en.png\" alt=\"settings-Images\" title=\"settings-Images - Images settings\" \/>\n<\/p>\n<h2><a id=\"general\"><\/a>General<br \/>\n<\/h2>\n<ul>\n<li><strong>Detect changes<\/strong>\n<p style=\"text-align:left\">\n      It is useful when images are changed in time. It forces to drop browser cache by appending time marker parameter to the image\u2019s URL.\n    <\/p>\n<p style=\"text-align:left\"><strong>Note.<\/strong> If <a href=\"#compr\">compression auto-redirection<\/a> is enabled then time marker will be used from the last modified compressed file.\n    <\/p>\n<\/li>\n<li><strong>Adjust attachments&#8217; URLs<\/strong>\n<p style=\"text-align:left\">\n      Process images at an early stage (before full<span style=\"font-size:12pt\"> <\/span>HTML of pages<span style=\"font-size:12pt\">\u00a0is generated)<\/span>. This makes it possible to process images that are not placed in standard<span style=\"font-size:12pt\"> <\/span><code>img<\/code><span style=\"font-size:12pt\"> tags<\/span> or styles.\n    <\/p>\n<p style=\"text-align:left\"><strong>Warning<\/strong><span style=\"font-size:12pt\">. <\/span>May be incompatible with some themes or plugins.\n    <\/p>\n<\/li>\n<li><strong>Inline smaller than<\/strong>\n<p style=\"text-align:left\">\n      Inlines small images into HTML and CSS to decrease request count to our server.\n    <\/p>\n<\/li>\n<li><strong>Deinline equal or larger<\/strong>\n<p style=\"text-align:left\">\n      Deinlines large images from HTML and CSS to decrease page size.\n    <\/p>\n<\/li>\n<li><a id=\"compr\"><\/a><strong>Adaptive redirection for simple external cache<\/strong>\n<p style=\"text-align:left\">\n      Some servers ignore returning image type (MIME type) and cache without needed compression. This option can help to manage such cases.\n    <\/p>\n<\/li>\n<li><strong>Alternative redirection<\/strong>\n<p style=\"text-align:left\">\n      In case of unavailability of standard (server level) redirection mode this one can be used. It is a bit slower that the first one but allows to manage redirection image correctly. It replaces local images paths to special URL request, e.g. image path <code>data\/test-img-01.jpg<\/code> becomes <code>?seraph_accel_gi=data%2Ftest-img-01.jpg<\/code>.\n    <\/p>\n<\/li>\n<\/ul>\n<h2>\n  Compression<br \/>\n<\/h2>\n<p>\n  Enables compression of JPG, PNG, GIF and BMP images except animated GIF and PNG ones. It creates compressed images for original ones. If last modified date of original image is changed to larger value (i.e. file is updated to fresh version), then it will be recompressed again.\n<\/p>\n<p>\n  E.g. for <code>image1.png<\/code> will be created file <code>image1.png.webp<\/code>. If compressed file can\u2019t be created or not needed (e.g. it is larger) then <code>image1.png.webp.json<\/code> will be created with the reason inside.\n<\/p>\n<p><strong><span style=\"font-size:12pt\">Note<\/span><\/strong><span style=\"font-size:12pt\">. <\/span><span style=\"font-size:12pt\">To <\/span><strong><span style=\"font-size:12pt\">exclude<\/span><\/strong><span style=\"font-size:12pt\"> a file from compression (for example,<\/span><span style=\"font-size:12pt\"> <\/span><span style=\"font-size:12pt\">WEBP<\/span><span style=\"font-size:12pt\">), you need <\/span><span style=\"font-size:12pt\">to create a file<\/span><span style=\"font-size:12pt\"> <\/span><code>image1.png.webp.json<\/code><span style=\"font-size:12pt\"> <\/span><span style=\"font-size:12pt\">next to this file (for example,<\/span><span style=\"font-size:12pt\"> <\/span><code>image1.png<\/code><span style=\"font-size:12pt\"> ) <\/span><span style=\"font-size:12pt\">with a date later than the file itself.<\/span><span style=\"font-size:12pt\"> <\/span><span style=\"font-size:12pt\">If file <\/span><code>image1.png.webp<\/code><span style=\"font-size:12pt\"> exists it should be deleted manually.<\/span>\n<\/p>\n<ul start=\"7\">\n<li><strong>Enable WebP<\/strong>\n<p style=\"text-align:left\">\n      Enables creating of WebP compressed files for original ones.\n    <\/p>\n<ul>\n<li><strong>Quality<\/strong>\n<p style=\"text-align:left\">\n          Lower quality produces lower file size.\n        <\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>Auto-redirect to WebP version<\/strong>\n<p style=\"text-align:left\">\n      Adds some directives into the <code>.htaccess<\/code> file to redirect images to their WebP versions. E.g. if <code>image1.png.webp<\/code> exists then <code>image1.png<\/code> will be redirected to it.\n    <\/p>\n<\/li>\n<li><strong>Enable Avif<\/strong>\n<p style=\"text-align:left\">\n      Enables creating of Avif compression files for original ones. If Webp creation is enabled and Avif file is larger than Webp it won\u2019t be written. Compressing to Avif can take long time so it is disabled by default.\n    <\/p>\n<ul>\n<li><strong>Quality<\/strong>\n<p style=\"text-align:left\">\n          Lower quality produces lower file size.\n        <\/p>\n<\/li>\n<li><strong>Speed<\/strong>\n<p style=\"text-align:left\">\n          Lower speed produces lower file size but it can take a lot of time.\n        <\/p>\n<\/li>\n<\/ul>\n<p style=\"text-align:left\"><strong>Note.<\/strong> It is available from<span style=\"font-size:12pt\"> <\/span>PHP<span style=\"font-size:12pt\"> <\/span>8.1 and upper and if the \u2018GD\u2019 extension is built with AVIF support. Or if \u2018IMAGEMAGICK\u2019 PHP\u2019s extension is installed and supports AVIF. Or it is supported by special encoder from our side as a binary executable module (currently only Lunux x64 and Windows x64).<a id=\"_Hlk111995007\"><\/a> It is automatically downloaded when needed from our site and executed. So, if PHP \u2018<a href=\"https:\/\/www.php.net\/manual\/en\/function.proc-open.php\" rel=\"nofollow noopener\" target=\"_blank\">proc_open<\/a>\u2019, \u2018<a href=\"https:\/\/www.php.net\/manual\/en\/function.proc-close.php\" rel=\"nofollow noopener\" target=\"_blank\">proc_close<\/a>\u2019, and \u2018<a href=\"https:\/\/www.php.net\/manual\/en\/function.chmod.php\" rel=\"nofollow noopener\" target=\"_blank\">chmod<\/a>\u2019 functions are blocked, please, check your hosting PHP\u2019s configuration.\n    <\/p>\n<\/li>\n<li><strong>Auto-redirect to Avif version<\/strong>\n<p style=\"text-align:left\">\n      Adds some directives into the <code>.htaccess<\/code> file to redirect images to their Avif versions. E.g. if <code>image1.png.avif<\/code> exists then <code>image1.png<\/code> will be redirected to it.\n    <\/p>\n<\/li>\n<li><strong>Process asynchronously<\/strong>\n<p style=\"text-align:left\">\n      Compression will be made in separate process and shown in <a href=\".\/status-and-operations-accel#queue\">processing queue<\/a> as separate item.\n    <\/p>\n<p style=\"text-align:left\"><strong>Note.<\/strong> If \u2018Detect changes\u2019 is enabled then might be need to reoptimize page that contain images to show corresponding compressed images.\n    <\/p>\n<\/li>\n<\/ul>\n<p>\n  To <strong>enable auto-redirection to WebP and Avif<\/strong> version <strong>under NGINX<\/strong> the following directives should be added manually into the begin of <code>server<\/code> directive:\n<\/p>\n<p><code class=\"p\"># seraphinite-accelerator - Automatic redirection to Avif and WebP versions if they exist<br \/>include \/www\/wwwroot\/my-site.com\/seraph-accel-img-compr-redir.conf;<\/code>\n<\/p>\n<p>\n  And the <code>\/www\/wwwroot\/my-site.com<\/code> should be replaced by your site\u2019s root filesystem path.\n<\/p>\n<p><strong>Note.<\/strong> If external cache is enabled then images can be show with original versions. If so, please, clear the external cache.\n<\/p>\n<p><strong>Note.<\/strong> Compression is currently processed only for images that can be caught by content processing like HTML <code>img<\/code> tag and CSS <code>url<\/code> attribute.\n<\/p>\n<p><strong>Note<\/strong><span style=\"font-size:12pt\">. <\/span>After changing the settings, you need to manually update the<span style=\"font-size:12pt\"> <\/span>NGINX configuration.\n<\/p>\n<h2><a id=\"adapt\"><\/a>Adaptation to screen sizes<br \/>\n<\/h2>\n<p>\n  It decreases images size on smaller screen sizes like mobiles. It is better to show smaller images on smaller screens to decrease network traffic and increase loading speed. Adaptation is made to popular 360-, 480-, 768-, 992-, 1366-, and 1920-pixels wide screens.\n<\/p>\n<ul>\n<li><strong>Ordinary images<\/strong>\n<p style=\"text-align:left\">\n      All images with <code>img<\/code> tag will be processed.\n    <\/p>\n<\/li>\n<li><strong>Background images<\/strong>\n<p style=\"text-align:left\">\n      All background images that defined in <a href=\".\/settings-styles-accel\">styles<\/a> by <code>background-image<\/code> or <code>background<\/code> properties (inline or separated) will be processed.<br \/><strong>Note.<\/strong> Exclusions for separated styles can\u2019t be added by item\u2019s basis.\n    <\/p>\n<\/li>\n<li><strong>Larger than pixels wide<\/strong>\n<p style=\"text-align:left\">\n      Reduced images will be created not smaller than this defined size.\n    <\/p>\n<\/li>\n<li><strong>Use Device Pixel Ratio<\/strong>\n<p style=\"text-align:left\">\n      Use Device Pixel Ratio.\n    <\/p>\n<\/li>\n<\/ul>\n<ul start=\"12\">\n<li><strong>Process asynchronously<\/strong>\n<p style=\"text-align:left\">\n      Adaptation (resizing and cropping) will be made in separate process and shown in <a href=\".\/status-and-operations-accel#queue\">processing queue<\/a> as separate item.\n    <\/p>\n<\/li>\n<li><strong>On demand<\/strong>\n<p style=\"text-align:left\">\n      Adaptation (resizing and cropping) will be made only while real request. It is enabled and \u2018Process asynchronously\u2019 disabled by default due to in most cases resizing and cropping are very fast.\n    <\/p>\n<\/li>\n<\/ul>\n<h3>\n  Excludes<br \/>\n<\/h3>\n<p>\n  Element tags that are matching the specified <a href=\".\/xpath-elements-selector-accel\">XPath selectors<\/a> will not be processed. E.g. the selector <code>.\/style[contains(text(),'img-01.jpg')]<\/code> excludes all separated styles that contain <code>img-01.jpg<\/code>. Or e.g. the selector <code>.\/\/div[contains(@style,'img-02.jpg')]<\/code> excludes all <code>div<\/code> tags with inline style that contains <code>img-02.jpg<\/code>. It can be added multiple selectors at once by placing each on new line.\n<\/p>\n<p><a id=\"lazy_load\"><\/a><strong>Note<\/strong>: Prefix <code>ajs<\/code> can be used to force load original images before loading main scripts. E.g. <code>ajs:.\/\/div[contains(@style,'img-02.jpg')]<\/code>.\n<\/p>\n<h2>\n  Lazy load<br \/>\n<\/h2>\n<ul>\n<li><strong>Add original size<\/strong>\n<p style=\"text-align:left\">\n      Just adds the original image\u2019s width and height to the \u2018img\u2019 tag attributes.\n    <\/p>\n<\/li>\n<li><strong>Enable<\/strong>\n<p style=\"text-align:left\">\n      Enables this mode.\n    <\/p>\n<ul>\n<li><strong>Own algorithm<\/strong>\n<p style=\"text-align:left\">\n          Don\u2019t use native <code>loading=\"lazy\"<\/code> attribute.\n        <\/p>\n<ul>\n<li><strong>Smooth appearing<\/strong>\n          <\/li>\n<li><strong>Raster placeholders<\/strong>\n          <\/li>\n<\/ul>\n<\/li>\n<li><strong>Remove 3rd party ones<\/strong>\n      <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\n  Excludes<br \/>\n<\/h3>\n<p>\n  Image tags that are matching the specified <a href=\".\/xpath-elements-selector-accel\">XPath selectors<\/a> will not be processed. E.g. to exclude first 5 images on all pages we should add <code>.\/\/img[position()&lt;=5]<\/code> expression. It can be added multiple selectors at once by placing each on new line.\n<\/p>\n<p><strong>Note:<\/strong> It applies to <a href=\".\/settings-frames-accel#lazy_load\">frames lazyloading<\/a> too excluding adapted placeholder.\n<\/p>\n<p><strong>Note<\/strong>: Prefix <code>ajs<\/code> can be used to force load original images before loading main scripts. E.g. <code>ajs:.\/\/img[position()&lt;=5]<\/code>.\n<\/p>\n<h2><a id=\"cache_ext\"><\/a>Cache external<br \/>\n<\/h2>\n<p>\n  All external images\u2019 URLs that are matched with defined <a href=\".\/regexp-accel\">regular expression<\/a> patterns will be cached. It can be added multiple expressions at once by placing each on new line.\n<\/p>\n<p>\n  It is useful to cache external images with short period if life time like images from <a href=\"https:\/\/www.instagram.com\/\" rel=\"nofollow noopener\" target=\"_blank\">Instagram<\/a>. If it wont be cached pages will contain this images that are broken after some time.\n<\/p>\n<p><strong>Note.<\/strong> If the regular expression contains the<span style=\"font-size:12pt\"> <\/span><code>crit:<\/code><span style=\"font-size:12pt\"> prefix<\/span>, then if it is impossible to copy the image, the optimization process will stop with an error.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>General Detect changes It is useful when images are changed in time. It forces to drop browser cache by appending time marker parameter to the image\u2019s URL. Note. If compression auto-redirection is enabled then time marker will be used from the last modified compressed file. Adjust attachments&#8217; URLs Process images at an early stage (before&#8230;<\/p>\n","protected":false},"author":18,"featured_media":0,"parent":4812,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"rank_math_lock_modified_date":false},"categories":[816],"tags":[],"class_list":["post-4829","doc","type-doc","status-publish","hentry","category-accelerator"],"_links":{"self":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/doc\/4829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/doc"}],"about":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/types\/doc"}],"author":[{"embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/comments?post=4829"}],"up":[{"embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/doc\/4812"}],"wp:attachment":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/media?parent=4829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/categories?post=4829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/tags?post=4829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}