Newscoop\Image\ImageService::save PHP Method

save() public method

Save image
public save ( array $info ) : string
$info array
return string
    public function save(array $info)
    {
        if (!in_array($info['type'], $this->supportedTypes)) {
            throw new \InvalidArgumentException("Unsupported image type '{$info['type']}'.");
        }
        $name = sha1_file($info['tmp_name']) . '.' . array_pop(explode('.', $info['name']));
        if (!file_exists(APPLICATION_PATH . "/../images/{$name}")) {
            rename($info['tmp_name'], APPLICATION_PATH . "/../images/{$name}");
        }
        return $name;
    }