code: private function isFastlyImageOptimizationEnabled()
      {
          if ($this->isFastlyEnabled !== null) {
              return $this->isFastlyEnabled;
          }
  
          $this->isFastlyEnabled = true;
  
          if ($this->_scopeConfig->isSetFlag(Config::XML_FASTLY_IMAGE_OPTIMIZATIONS) == false) {
              $this->isFastlyEnabled = false;
          }
  
          if ($this->_scopeConfig->getValue(PageCacheConfig::XML_PAGECACHE_TYPE) !== Config::FASTLY) {
              $this->isFastlyEnabled = false;
          }
  
          return $this->isFastlyEnabled;
      }
docs: On/Off switch based on config value
  
  @return bool