Coder Social home page Coder Social logo

cloudverve / wordpress-cloud-media-offloader-plugin Goto Github PK

View Code? Open in Web Editor NEW
63.0 10.0 13.0 3.66 MB

A simple plugin that allows you to serve your WordPress Media Library files from the Backblaze B2 cloud storage service.

License: GNU General Public License v2.0

JavaScript 15.56% PHP 84.44%
backblaze wordpress wordpress-plugin wordpress-media media-library b2 cloud-media-offloader

wordpress-cloud-media-offloader-plugin's Introduction

Author Latest Version GitHub License Composer Downloads Donate Flywheel Twitter

Cloud Media Offloader Plugin for WordPress

This is currently under development and contains bugs. Test in a development environment first and use at your own risk.

โฉ Download Installable ZIP: cloud-media-offloader.zip

Contents

Description

This is a WordPress plugin that allows you to serve your WordPress Media Library files via the Backblaze B2 cloud storage service.

Features

  • Limit offloading by MIME types
  • Option to remove files from origin server
  • Shortcode to create hyperlinks and output image tags
  • ๐Ÿ†• CloudFlare support (more info)

Contributing

One of the best ways that you can contribute is to help me make it better, either with code or with constructive feedback. Ways to help:

  • I am open to pull requests and welcome improvements.
  • Feedback on how I can make it better.
  • Translations (or donations to create/maintain them)

Installation

Download the installable WordPress ZIP file and install via Plugins > Add New in WP Admin.

Requirements

  • WordPress 4.7 or higher
  • PHP 7.0 or higher

Composer

If you manage plugins with Composer, this plugin is on Packagist.

composer require cloudverve/wordpress-cloud-media-offloader-plugin

Known Compatibilities & Conflicts

Known Compatibilities

Conflicts

If you encounter any conflicts, please report them.

Future Goals

  • Private buckets support
  • Add hook on media upload
  • Support for other object storage services
  • WooCommerce support

Long-Term

  • Add ability to password-protect content, time-expiring URLs and relevant tracking/statistics
  • Add one-click feature to migrate existing local media to B2
  • Possibility of serving external CSS/JS from B2 bucket

Screenshots

Settings Page

Media Library Image Properties

wordpress-cloud-media-offloader-plugin's People

Contributors

dmhendricks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-cloud-media-offloader-plugin's Issues

Multisite support

Versions

  • Cloud Media Offloader:
  • WordPress: Multisite
  • PHP: 7.2
  • Hosting Environment (ie, Windows, Linux): Linux

Description of Issue/Request

Thanks for greate plugin. Does this support WP Multisite enable with domain mapping?

Thanks again!

Renaming & Moving the Plugin

I have just been asked by someone from Backblaze to rename the plugin so that it does not include their name. I will likely do this within the next few days, a week at most. I'm also going to move the plugin to my GitHub organization repo (and thus update Packageist). I will continue to be the developer and maintainer of the plugin, just the names will change.

I will post an announcement here, with the new link, when this happens. If you are watching this repo, you will be notified. I will also update all references within the plugin and do a new release.

I will probably rename it to something generic that will allow me to potentially add other cloud storage providers in the future (such as S3-compatible1 or OVH's object storage), if there ever becomes any interest. First thing is first - I have to get it stable with B2.

I apologize for the inconvenience.

1 I am aware that there is/are already plugins for AWS S3, but I am not aware of any that support S3-compatible services such as DreamHost's Object Storage or DigitalOcean's Spaces, as examples, so they might be nice additions some day.

Packagist Install Errors

Hi Hi!

When I try to require it, it gives me this error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for cloudverve/wordpress-cloud-media-offloader-plugin ~0.7.3 -> satisfiable by cloudverve/wordpress-cloud-media-offloader-plugin[0.7.3].
    - cloudverve/wordpress-cloud-media-offloader-plugin 0.7.3 requires dmhendricks/wordpress-toolkit dev-master -> satisfiable by dmhendricks/wordpress-toolkit[dev-master] but these conflict with your requirements or minimum-stability

But when I move my minimum stability to dev, i get this error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for cloudverve/wordpress-cloud-media-offloader-plugin ~0.7.3 -> satisfiable by cloudverve/wordpress-cloud-media-offloader-plugin[0.7.3].
    - cloudverve/wordpress-cloud-media-offloader-plugin 0.7.3 requires dmhendricks/b2-sdk-php dev-master -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

What am I doing wrong? :)

Adds trailing slash and file deletion

Versions

  • Cloud Media Offloader: 0.8.0
  • WordPress: 5.0.3
  • PHP: 7.1
  • Hosting Environment (ie, Windows, Linux): Linux, Cpanel

Description of Issue/Request

When an image is uploaded, there is an HTTP ERROR. Then the file path looks like so...

https://cdn.mywebsite.com/file/BucketName//2019/01/image-name.jpg

A trailing slash before the actual folder in the bucket. This only happens if you leave the optional path empty. I was able to fix by adding a folder name (wp-media)...

https://cdn.mywebsite.com/file/BucketName/wp-media/2019/01/image-name.jpg

Also having issues deleting an image if the path is incorrect. Once the proper path is added, then it works.

When using root folder, you need to untrailslash line 178 in b2.php

When using root folder with b2, there's an additional trailing slash that breaks the links in the media library.
starting at line 171:

return array( 'ID' => $attachment_id, 'filepath' => $filepath, 'filename' => basename( $filepath ), 'url' => wp_get_attachment_url( $attachment_id ), 'subdir' => trim( $uploads['subdir'], DIRECTORY_SEPARATOR ), 'destpath' => $remote_path . untrailingslashit( $uploads['subdir'] ), 'destfile' => $remote_path . untrailingslashit( $uploads['subdir'] ) . basename( $filepath ), // This is the line that went from trail to untrail 'mime_type' => get_post_mime_type( $attachment_id ) );

Plugin could not be activated because it triggered a fatal error.

Fatal error: Uncaught TypeError: Argument 1 passed to Dotenv\Dotenv::__construct() must implement interface Dotenv\Store\StoreInterface, string given, called in /var/www/pointhr.net/blog/wp-content/plugins/cloud-media-offloader/vendor/dmhendricks/wordpress-toolkit/core/ToolKit.php on line 175 and defined in /var/www/pointhr.net/blog/vendor/vlucas/phpdotenv/src/Dotenv.php:60 Stack trace: #0 /var/www/pointhr.net/blog/wp-content/plugins/cloud-media-offloader/vendor/dmhendricks/wordpress-toolkit/core/ToolKit.php(175): Dotenv\Dotenv->__construct() #1 /var/www/pointhr.net/blog/wp-content/plugins/cloud-media-offloader/vendor/dmhendricks/wordpress-toolkit/core/ToolKit.php(160): WordPress_ToolKit\ToolKit->load_env_from_apth() #2 /var/www/pointhr.net/blog/wp-content/plugins/cloud-media-offloader/vendor/dmhendricks/wordpress-toolkit/core/ToolKit.php(62): WordPress_ToolKit\ToolKit->load_env_vars() #3 /var/www/pointhr.net/blog/wp-content/plugins/cloud-media-offloader/app/Plugin.php(24): WordPress_ToolKit\ToolKit->init() #4 /var/www/po in /var/www/pointhr.net/blog/vendor/vlucas/phpdotenv/src/Dotenv.php on line 60

Versions

  • Cloud Media Offloader: 0.8.0 & 0.8.1
  • WordPress: 5.8.1
  • PHP: php7.4-fpm
  • Hosting Environment (ie, Windows, Linux): localhost on ubuntu 20.04 on wsl2 windows 10

Description of Issue/Request

download the plugin, install, activate.
image

Add to packagist.org

Would it be too much trouble to add this to Packagist.org? Iโ€™m trying to manage all of my plugins via one composer file.

Add support for CDN (feature request)

Add the option to add a CDN in front of Backblaze for faster delivery. For example let's say I want to use Cloudflare as a free CDN in front of my Backblaze cloud storage, after setting this up (example here), I should be able to use something like cdn.mydomain.com/file/folder/file and still access the file stored on the cloud storage but through Cloudflare as a (free) CDN. These are just some suggestions. Making the website even faster now since it won't have to serve large static assets by itself but use the cheap Backblaze B2 service as storage and Cloudflare as a free CDN. By the way Backblaze and Cloudflare partnered to offer free download bandwidth through Cloudflare. Article here

Now there might be some issues. If the site is not new, with exisiting files, they will need to be copied (or moved) to Backblaze to benefit from the CDN performance boost. Otherwise some files would still use the links of the assets hosted on the origin server. And if you use a CDN already with the site then you'll then have two CDN links (backblaze-cdn.mydomain.com and regular-cloudflare-cdn.mydomain.com) or in the worst case have some broken links.

Hope I gave enough information for more than one scenario. Thanks!

Will you keep maintaining the plugin?

I have just tested the plugin in the latest WordPress (5.5.1).

It still works without any problems. I like the simplicity.

The last update is 2 years ago...will you keep maintaining the good plugin?

Ready for Testing

I believe this plugin is in a state where it is ready for testing. There are likely to be bugs and incompatibilities - if you encounter them, please create a new issue.

Submitting a Bug

If you submit a bug, the more relevant information that you include, the more easy it will be for me to try to reproduce/debug:

  • WordPress and PHP version*
  • Your operating system and browser(s) that you used when you experienced the issue.
  • Server operating system, web server (Apache, Nginx, etc), if known.*
  • Report any errors/notices that are thrown (since the media library uploader uses AJAX, Error Log Monitor can be handy for quickly seeing what was generated).
  • Screenshots, if relevant. Snaggy can be useful for pasting screenshots.
  • If it is a conflict with a specific plugin, please note the version of said plugin that you are using.
  • Please separate different issues into their own posts, unless they are related.

*If you're not familiar with your environment, some of this information you can get by creating a file in the root of your web site (named something like info.php) with the following content:

<?php
phpinfo();
?>

Then visit http://yoursite.com/info.php (for example) to view the output.

If you create this file, delete it when you are finished.

Blank Images with Remove Files From Server

When Remove Files From Server is enabled in newer versions of WordPress, the images are blank in Media Library. They are uploaded/removed/linked properly, however, they appear blank in the Media Library browser.

Fatal Error Thrown on Plugin Activation

I just clone this repo in my wordpress plugins folder and it throw some fatal error. Can't be actived because Fatal error: Uncaught Error: Class 'CloudVerve\MediaOffloader\Plugin'

How to upgrade

How to upgrade it from 0.8.0 to 0.8.1. If I remove 0.8.0 and install 0.8.1 will it cause any error or system issue.

Thanks

Activation Error

`Warning: require(/home/username/spyonaz.com/wp-content/plugins/backblaze-media-offloader-master/vendor/composer/../guzzlehttp/guzzle/src/functions_include.php): failed to open stream: No such file or directory in /home/username/spyonaz.com/wp-content/plugins/backblaze-media-offloader-master/vendor/composer/autoload_real.php on line 66

Fatal error: require(): Failed opening required '/home/username/spyonaz.com/wp-content/plugins/backblaze-media-offloader-master/vendor/composer/../guzzlehttp/guzzle/src/functions_include.php' (include_path='/home/username/spyonaz.com/wp-content/plugins/wd-google-analytics/google/vendor/phpseclib/phpseclib/phpseclib:.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/username/spyonaz.com/wp-content/plugins/backblaze-media-offloader-master/vendor/composer/autoload_real.php on line 66`

Keeps triggering "List Bucket"

Not sure what the cause is, but I had over 20,000 LIST BUCKET commands come from this plugin in one day. I'm not sure if something changed or if something in my wordpress admin is triggering it to run over and over again.

Versions

  • Cloud Media Offloader:
  • WordPress:
  • PHP:
  • Hosting Environment (ie, Windows, Linux):

Description of Issue/Request

Replace this with your issue/request. Where possible and relevant, please include any helpful console/browser errors, log entries and/or screenshots. Basically, do your best to help me reproduce the problem.

B2 App Key Auth

Versions

  • Cloud Media Offloader: 0.8.1
  • WordPress: 5.1
  • PHP: 7.3
  • Hosting Environment (ie, Windows, Linux): Linux

Description of Issue/Request

Hi Daniel. Just taking a look at using this plugin that you've written. I'm far from being a coder, but would like to help out if I can :)

I've tried to use this with a B2 app key instead of the master key as I want to be able to protect the master key as this plugin will be installed on a client WP site using a bucket in our account.

When I enter the app key and save the settings, no buckets are in the list, even though the app key has the list buckets permission. I have limited the app key to a single bucket. I should mention that it does work fine if I do use the master key.

Is there something I need to change for this to work or can this only work using the master key?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.