interfacelab
Forum Replies Created
-
You can only use Imgix’s CDN if you are using Imgix. It’s against their terms of service to do otherwise.
If you want to use your CDN, then you can’t use Imgix.
I don’t know anything about WooCommerce, but typically you’d define a custom size in your functions.php and then use that custom size in your theme where you want it.
The plugin will generate the correct parameters based on how you’ve defined the size.
It looks like my reply is being held in moderation for some reason.
Do let me know if you implement this and I will add a blurb to the read me/plugin page about it.
Thanks!
Also, one thing to note is that you’d have to rename all the images size ONLY if Imgix wasn’t being used. If Imgix is enabled, the plugin disables any thumbnail generation that WordPress might do, relying on Imgix to do that. So, in that case, if Imgix is enabled you only have to rename a single file.
I probably wouldn’t add this to Media Cloud, mostly because I only add features my clients request or need for a given build.
However, you could add this to your plugin, fairly easily I think. Off the top of my head you’d have to:
- Detect if media cloud plugin was activated via
is_plugin_active('ilab-media-tools') - The
\ILAB\MediaCloud\Tools\ToolsManager::instance()is the entry point into the plugin itself. You won’t have to include/require any files as it should autoload. - Determine if cloud storage is enabled and activated by doing something like
\ILAB\MediaCloud\Tools\ToolsManager::instance()->toolEnabled('storage') - If it’s enabled, you can get the storage interface via
\ILAB\MediaCloud\Tools\ToolsManager::instance()->tools['storage'] - Once you have the storage interface, you can copy a file to a new one and delete the old one. Refer to
classes/Cloud/Storage/StorageInterface.phpfor the method signatures, but it’d only be two calls. - The data for storage is held in an array in an attachment’s meta (you can fetch with
wp_get_attachment_metadata($id)calleds3. Use and update the values in that.
I think that’s all you’d have to do to get it working.
In theory 😉
- This reply was modified 7 years, 8 months ago by interfacelab.
- This reply was modified 7 years, 8 months ago by interfacelab.
Add something like this to your functions.php:
add_filter('ilab_s3_can_calculate_srcset',function($calcSrcSet){ return false; }, 10000, 1);Imgix can work that way, but this plugin can’t. The plugin replaces all of your image URLs in your site with ones that point to Imgix. So if you want Imgix to pull images from your site, where would it pull it from? It would be possible to add, but I can’t see the effort being worth it when S3 is so cheap and, in my honest opinion, it’s just a bad practice to keep your media on your wordpress server to begin with.
Your S3 bill for 50,000 images totaling 10GB of space is going to be less than a dollar.
This is fixed in 2.1.5
Honestly, I don’t worry about it. It’s typically a trivial amount of overhead. HTTP2 push makes it even more trivial. If you have http cache headers setup on your server correctly then that’s good enough for me.
Make sure you have set the CORS configuration on your amazon S3 bucket to something like:
<?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSeconds> <AllowedHeader>Authorization</AllowedHeader> </CORSRule> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>PUT</AllowedMethod> <AllowedMethod>POST</AllowedMethod> <AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration>- This reply was modified 7 years, 8 months ago by interfacelab.
Note, if you want to continue to use backblaze and this plugin, you will have to fork it :). Thank god for open source 😉
@lukoie, why not use
@{site-name}/@{date:Y/m}I don’t understand what you guys are asking for exactly.
In Storage settings you can change the upload path to whatever you want.
Thanks for the kind words.
Unfortunately, it’s not possible with the plugin. If you wanted to write the script yourself to do it, the plugin stores all the cloud related info in the attachment’s meta called ‘s3’ and is a serialized PHP array:
array ( 'url' => 'https://your-bucket.s3-accelerate.amazonaws.com/2018/09/image.png', 'bucket' => 'your-bucket', 'privacy' => 'public-read', 'key' => '2018/09/image.png', 'provider' => 's3', 'options' => array ( ), 'mime-type' => 'image/png', )So you would loop through minio, create the attachment with wp-cli and then update the new attachment’s meta data with the above. Something like that.
The plugin does have some wp-cli commands in the
classes/CLIdirectory. You could use this a starting point to write a wp-cli command that you could then contribute to the plugin in github 😉Good luck 🙂
Wordpress doesn’t store size information in the DB, so it’s impossible for this plugin to display it.
This is fixed (or should be) in 2.1.4
- Detect if media cloud plugin was activated via