/**
* returns the path to a temp file
*
* @return string
*/
public function getTemporaryFile($fullPath = false)
{
$destinationPath = PIMCORE_TEMPORARY_DIRECTORY . "/asset-temporary/asset_" . $this->getId() . "_" . md5(microtime()) . "__" . $this->getFilename();
if (!is_dir(dirname($destinationPath))) {
File::mkdir(dirname($destinationPath));
}
$src = $this->getStream();
$dest = fopen($destinationPath, "w+");
stream_copy_to_stream($src, $dest);
fclose($dest);
@chmod($destinationPath, File::getDefaultMode());
if ($fullPath) {
return $destinationPath;
}
return str_replace(PIMCORE_DOCUMENT_ROOT, "", $destinationPath);
}