public function writeToStore(AssetStore $assetStore, $filename, $hash = null, $variant = null, $config = array())
 {
     // Write to temporary file, taking care to maintain the extension
     $path = tempnam(sys_get_temp_dir(), 'imagemagick');
     if ($extension = pathinfo($filename, PATHINFO_EXTENSION)) {
         $path .= "." . $extension;
     }
     $this->writeimage($path);
     $result = $assetStore->setFromLocalFile($path, $filename, $hash, $variant, $config);
     unlink($path);
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * Assign this temporary file into the given destination
  *
  * @param array $tmpFile
  * @param string $filename
  * @param AssetContainer|AssetStore $container
  * @return array
  */
 protected function storeTempFile($tmpFile, $filename, $container)
 {
     // Save file into backend
     $conflictResolution = $this->replaceFile ? AssetStore::CONFLICT_OVERWRITE : AssetStore::CONFLICT_RENAME;
     $config = array('conflict' => $conflictResolution, 'visibility' => $this->getDefaultVisibility());
     return $container->setFromLocalFile($tmpFile['tmp_name'], $filename, null, null, $config);
 }
Ejemplo n.º 3
0
 /**
  * Assign this temporary file into the given destination
  *
  * @param array $tmpFile
  * @param string $filename
  * @param AssetContainer|AssetStore $container
  * @return array
  */
 protected function storeTempFile($tmpFile, $filename, $container)
 {
     // Save file into backend
     $conflictResolution = $this->replaceFile ? AssetStore::CONFLICT_OVERWRITE : AssetStore::CONFLICT_RENAME;
     return $container->setFromLocalFile($tmpFile['tmp_name'], $filename, null, null, $conflictResolution);
 }