You are here

public function VclHandler::removeImageOptimization in Fastly 8.3

Remove Image optimization feature.

Return value

bool

File

src/VclHandler.php, line 1186

Class

VclHandler
Class to control the VCL handling.

Namespace

Drupal\fastly

Code

public function removeImageOptimization() {
  $this
    ->cloneLastActiveVersion();
  $data['name'] = self::IMAGE_OPTIMIZER_BASIC_IMAGE_SETTINGS . '_recv';
  if ($this
    ->getSnippetId($data)) {
    $this
      ->removeSnippet($this->lastClonedVersion, $data['name']);
  }

  // Activate Version.
  $this
    ->prepareActivateVersion();
  $request = $this
    ->prepareActivateVersion();
  $response = $this
    ->vclRequestWrapper($request['url'], $request['headers'], [], $request['type']);
  if ($response
    ->getStatusCode() != "200") {
    $this->messenger
      ->addError($response
      ->getBody());
    return FALSE;
  }
}