Implemented possibility to choose external cloud storage

eriche

Member
Hello,

I think it would be a good idea, to give the administrator in the ACP the chance to choose where the uploaded images are stored.

When the webhoster has limited storage, you may want to host the images on one of the cloud image hoster ;)
Also great would be to link each category with an external cloud hoster.

So you can decide, if category "cars" should store images on the local hdd or if the images should be stored somewhere else and only be linked.

The forum member shouldn`t take note where the images are stored.
For him uploading always feels the same :D

Erich
 
Upvote 4
This suggestion has been implemented. Votes are no longer accepted.
I am realy wondering why nobody from the stuff is commenting this suggestion :eek: even there are some likes.

It is not only the limited space from a Webhoster which makes hosting a gallery very expensive.
Most Webhosters give you an amount of files you can store.
So only with the Xenforo installation plus the plugins I need I reached 1/5th if files I can store.

I am afraid from giving members the right to upload pictures like they want - because then I am forced to invest more money in storing more files.

So when there is no reaction to this suggestion, I would like to hear from other members how are you solving the problem with the limited storage or file count in your Webspace o_O

I know that Xenforo will not build a bridge to all Image Hosters - but it would be fine to get the core.
Then we, the users, can develope the connection to a specific hoster, if the API already is implemented.

Erich
 
This is now implemented via XF2's abstracted file system.

It isn't a specific gallery option, but XF2 supports using cloud storage providers (though these additional providers would likely need to come via an add-on).
 
Are there any plans to provide 1st party implementations of popular cloud storage providers (eg S3 / Rackspace) ?

As useful as the flexibility is, I'd rather not be relying on 3rd party addons for such critical functionality.

Even if there were just one or two options provided, that then gives us a "default" option we can choose to use - if we then choose to use a 3rd party option which subsequently becomes unusable due to lack of updates, we can always fall back on those default options.

How much work is involved in implementing one of the existing flysystem adapters? Are such addons likely to be fairly trivial to implement or will there be a lot of work to make it all hang together?
 
It's worth a separate (XF) suggestion.

No immediate plans, but it would be worthwhile (it could be similar to how our CacheFactory stuff is set up which supports easy (or easier) configuration of the popular cache providers).

To clear something up, though, I wouldn't necessarily be too concerned about this kind of thing being third party. There's very little to go wrong. The extent of the code required (and essentially an advanced user could implement the entire thing in config.php) is basically thing (taking AWS S3 v3 as an example):
PHP:
$config['fsAdapters'] = [
   'data' => function()
   {
      $client = new \Aws\S3\S3Client([
         'credentials' => [
            'key'    => 'ABC',
            'secret' => '123'
         ],
         'region' => 'eu-west-2',
         'version' => 'latest',
      ]);

      return new \League\Flysystem\AwsS3v3\AwsS3Adapter($client, 'a.a.com', 'data');
   }
];

$config['externalDataUrl'] = function($externalPath, $canonical)
{
   return 'https://s3.eu-west-2.amazonaws.com/a.a.com/data/' . $externalPath;
};
The only things an add-on needs to do is:
1) Bring in the relevant Flysystem adapter
2) Bring in the providers client library (if applicable)
3) Provide some sort of configuration (for the most part, you'd just do this in config.php anyway)
 
Hello Chris,

It seem XF 2.0.1 installation dont autoload the required files.

I added the aws-sdk to the composer but still it pop this error.

Code:
PHP message: PHP Fatal error:  Uncaught Error: Class 'Aws\S3\S3Client' not found in /sites/web/src/config.php:26
Stack trace:
#0 [internal function]: XF\App->{closure}()
#1 /sites/web/src/XF/FsMounts.php(17): call_user_func(Object(Closure))
#2 /sites/web/src/XF/App.php(818): XF\FsMounts::loadDefaultMounts(Array)
#3 /sites/web/src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#4 /sites/web/src/XF/App.php(2103): XF\Container->offsetGet('fs')
#5 /sites/web/src/XF.php(542): XF\App->fs()
#6 /sites/web/src/XF/Util/File.php(483): XF::fs()
#7 /sites/web/src/XF/Error.php(100): XF\Util\File::installLockExists()
#8 /sites/web/src/XF/App.php(1891): XF\Error->logException(Object(ErrorException), false, '')
#9 /sites/web/src/XF.php(184): XF\App->logException(Object(ErrorException))
#10 [internal function]: XF::handleFatalError()

If i load the phar file without adding the composer changes it pop other different error.


Code:
PHP message: PHP Fatal error:  Uncaught Error: Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found in /sites/web/src/config.php:36
Stack trace:
#0 [internal function]: XF\App->{closure}()
#1 /sites/web/src/XF/FsMounts.php(17): call_user_func(Object(Closure))
#2 /sites/web/src/XF/App.php(818): XF\FsMounts::loadDefaultMounts(Array)
#3 /sites/web/src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#4 /sites/web/src/XF/App.php(2103): XF\Container->offsetGet('fs')
#5 /sites/web/src/XF.php(542): XF\App->fs()
#6 /sites/web/src/XF/Util/File.php(483): XF::fs()
#7 /sites/web/src/XF/Error.php(100): XF\Util\File::installLockExists()
#8 /sites/web/src/XF/App.php(1891): XF\Error->logException(Object(ErrorException), false, '')
#9 /sites/web/src/XF.php(184): XF\App->logException(Object(ErrorException))
#10 [internal function]:
 
Last edited:
Hello Chris,

It seem XF 2.0.1 installation dont autoload the required files.

I added the aws-sdk to the composer but still it pop this error.

Code:
PHP message: PHP Fatal error:  Uncaught Error: Class 'Aws\S3\S3Client' not found in /sites/web/src/config.php:26
Stack trace:
#0 [internal function]: XF\App->{closure}()
#1 /sites/web/src/XF/FsMounts.php(17): call_user_func(Object(Closure))
#2 /sites/web/src/XF/App.php(818): XF\FsMounts::loadDefaultMounts(Array)
#3 /sites/web/src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#4 /sites/web/src/XF/App.php(2103): XF\Container->offsetGet('fs')
#5 /sites/web/src/XF.php(542): XF\App->fs()
#6 /sites/web/src/XF/Util/File.php(483): XF::fs()
#7 /sites/web/src/XF/Error.php(100): XF\Util\File::installLockExists()
#8 /sites/web/src/XF/App.php(1891): XF\Error->logException(Object(ErrorException), false, '')
#9 /sites/web/src/XF.php(184): XF\App->logException(Object(ErrorException))
#10 [internal function]: XF::handleFatalError()

If i load the phar file without adding the composer changes it pop other different error.


Code:
PHP message: PHP Fatal error:  Uncaught Error: Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' not found in /sites/web/src/config.php:36
Stack trace:
#0 [internal function]: XF\App->{closure}()
#1 /sites/web/src/XF/FsMounts.php(17): call_user_func(Object(Closure))
#2 /sites/web/src/XF/App.php(818): XF\FsMounts::loadDefaultMounts(Array)
#3 /sites/web/src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#4 /sites/web/src/XF/App.php(2103): XF\Container->offsetGet('fs')
#5 /sites/web/src/XF.php(542): XF\App->fs()
#6 /sites/web/src/XF/Util/File.php(483): XF::fs()
#7 /sites/web/src/XF/Error.php(100): XF\Util\File::installLockExists()
#8 /sites/web/src/XF/App.php(1891): XF\Error->logException(Object(ErrorException), false, '')
#9 /sites/web/src/XF.php(184): XF\App->logException(Object(ErrorException))
#10 [internal function]:
Did you make any progress with this?
 
Top Bottom