1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-17 14:10:45 +02:00

[ticket/15276] Update file_info to get size of images

PHPBB3-15276
This commit is contained in:
Rubén Calvo
2017-08-09 22:08:45 +02:00
parent 3c60333725
commit 09856aeb26
9 changed files with 87 additions and 48 deletions

View File

@@ -36,24 +36,7 @@ class file_info
{
$this->adapter = $adapter;
$this->path = $path;
}
/**
* Load propertys lazily.
*
* @param string path The file path.
*/
protected function fill_properties($path)
{
if ($this->properties === null)
{
$this->properties = [];
foreach ($this->adapter->file_properties($this->path) as $name => $value)
{
$this->properties[$name] = $value;
}
}
$this->properties = [];
}
/**
@@ -65,8 +48,6 @@ class file_info
*/
public function get($name)
{
$this->fill_properties($this->path);
if (!isset($this->properties[$name]))
{
if (!method_exists($this->adapter, 'file_' . $name))
@@ -74,7 +55,7 @@ class file_info
throw new not_implemented();
}
$this->properties[$name] = call_user_func([$this->adapter, 'file_' . $name], $this->path);
$this->properties = array_merge($this->properties, call_user_func([$this->adapter, 'file_' . $name], $this->path));
}
return $this->properties[$name];