Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

external storage on remote webserver? (failed coding attempt) #506

Open
OhSoGood opened this issue Sep 2, 2021 · 3 comments
Open

external storage on remote webserver? (failed coding attempt) #506

OhSoGood opened this issue Sep 2, 2021 · 3 comments

Comments

@OhSoGood
Copy link

OhSoGood commented Sep 2, 2021

Hi,
My local COPS server is working (great! Thanks to all devs!). Now I'd like to get this setup: one server, hosting php code + database + thumbnails, accessing all ebooks and images from a remote static web server (typically a S3 storage).

Can anybody help? Or would even anybody kindly implement this for me (and many others that would enjoy benefiting from S3 cheap storage)? I'm a real newbee with PHP , and I tried what I could... Would it be interested to include that feature in the main branch of the project?

Reading through the code (I am a programmer but not in PHP), I had the feeling that very few things would need to be changed:

  1. I added a $config['external_storage'] = 'https://mys3torage.com/mybucket' in config_local.php
  2. In __construct in Book.php, I changed this:
	// Old code line 117:
	// $this->path = $config['external_storage'] . $line->path;
	// New code:
	if (empty($config['external_storage'])) {
		$this->path = Base::getDbDirectory() . $line->path;
	} else {
		$this->path = $config['external_storage'] . $line->path;
	}

And

	// Old code line 130:
        // if (!file_exists($this->getFilePath('jpg'))) {
	// New code:
        if (empty($config['external_storage']) && !file_exists($this->getFilePath('jpg'))) {
  1. I ensured in my php.ini that allow_url_fopen=1 so that in Book.php GetImageSize and imagecreatefromjpeg (both in getThumbnail) would work.

The site is still working on my remote server, but I got no thumbnail at all. Like if I had changed nothing (and I did clear the cache :) )

Thanks in advance!

@marioscube
Copy link

Don't know anything about S3-storage or PHP programming, but you could:

  • mount the S3-storage as a volume on your server and point COPS to that mountpoint.
  • use webDAV. Use webDAV mount on your server and point COPS to that mountpoint.

Should be possible with Linux and Windows as a server.

@OhSoGood
Copy link
Author

OhSoGood commented Sep 8, 2021 via email

@mikespub
Copy link

Included in release 2.7.1 at https://github.com/mikespub-org/seblucas-cops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants