1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-06 08:07:42 +02:00

adding support for alias #47

This commit is contained in:
Mikael Roos
2015-01-15 23:29:18 +01:00
parent c35587c7e2
commit f87dc2967f
4 changed files with 109 additions and 28 deletions

View File

@@ -2134,6 +2134,37 @@ class CImage
/**
* Create a hard link, as an alias, to the cached file.
*
* @param string $alias where to store the link.
*
* @return $this
*/
public function linkToCacheFile($alias)
{
if ($alias === null) {
$this->log("Ignore creating alias.");
return $this;
}
if (is_readable($alias)) {
unlink($alias);
}
$res = link($this->cacheFileName, $alias);
if ($res) {
$this->log("Created an alias to the cachefile: $alias");
} else {
$this->log("Failed to create the alias: $alias");
}
return $this;
}
/**
* Output image to browser using caching.
*