You are here

public function Manifest::deleteImage in Progressive Web App 8

Same name and namespace in other branches
  1. 2.x src/Manifest.php \Drupal\pwa\Manifest::deleteImage()

Deletes the images that are used for the manifest file.

Overrides ManifestInterface::deleteImage

File

src/Manifest.php, line 96

Class

Manifest
Manifest JSON building service.

Namespace

Drupal\pwa

Code

public function deleteImage() {
  $config = $this->configFactory
    ->get('pwa.config');
  $image = $config
    ->get('image');

  // Image exists and is NOT default.
  if (!empty($image) && $image[0] == '/') {

    // Image.
    $path = getcwd() . $image;
    unlink($path);

    // Image_small.
    unlink($path . 'copy.png');

    // Image_very_small.
    unlink($path . 'copy2.png');
  }
}