private function createAssetFile($assetFile, $assetObj, $dir, $originalFile, $renditions, $type) { $asset = null; if ($originalFile === null || $renditions === null) { // Nothing to save, just writing an existing file return $assetFile; } if (!is_null($assetObj)) { $asset = $assetObj; } else { if ($this->storage->isFile($assetFile)) { // Load existing asset file $asset = $this->getAssetObject($assetFile); } else { $asset = new binarypool_asset($this); } } $storeAbsolute = $this->storage->isAbsoluteStorage(); $asset->setBasePath($dir, $storeAbsolute); $asset->setOriginal($this->storage->absolutize($originalFile)); foreach ($renditions as $rendition => $filename) { $asset->setRendition($rendition, $this->absolutize($filename)); } // Expiry date if (!isset($this->bucketConfig['ttl'])) { throw new BinaryPoolException(116, 500, 'Bucket does not have a defined TTL: ' . $this->bucketName); } $asset->setExpiry(time() + intval($this->bucketConfig['ttl']) * 24 * 60 * 60); $asset->setType($type); // Done $this->saveAsset($asset, $assetFile); return $assetFile; }