mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
47 lines
862 B
PHP
47 lines
862 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Storage\Devices;
|
||
|
|
|
||
|
|
use Storage\Device;
|
||
|
|
|
||
|
|
class S3 extends Device
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getName()
|
||
|
|
{
|
||
|
|
return 'S3 Storage';
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getDescription()
|
||
|
|
{
|
||
|
|
return 'S3 Bucket Storage drive for AWS or on premise solution';
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getRoot()
|
||
|
|
{
|
||
|
|
return '/storage/uploads';
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param string $filename
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getPath($filename)
|
||
|
|
{
|
||
|
|
$path = '';
|
||
|
|
|
||
|
|
for ($i = 0; $i < 4; $i++) {
|
||
|
|
$path = ($i < strlen($filename)) ? $path . DIRECTORY_SEPARATOR . $filename[$i] : $path . DIRECTORY_SEPARATOR . 'x';
|
||
|
|
}
|
||
|
|
|
||
|
|
return $this->getRoot() . $path . DIRECTORY_SEPARATOR . $filename;
|
||
|
|
}
|
||
|
|
}
|