You are here

public function Micon::setArchive in Micon 2.x

Same name and namespace in other branches
  1. 8 src/Entity/Micon.php \Drupal\micon\Entity\Micon::setArchive()

Set the archive as base64 encoded string.

Parameters

string $zip_path: The URI of the zip file.

Return value

$this

Overrides MiconInterface::setArchive

File

src/Entity/Micon.php, line 172

Class

Micon
Defines the Micon entity.

Namespace

Drupal\micon\Entity

Code

public function setArchive($zip_path) {
  $data = strtr(base64_encode(addslashes(gzcompress(serialize(file_get_contents($zip_path)), 9))), '+/=', '-_,');
  $parts = str_split($data, 200000);
  $this
    ->set('archive', $parts);
}