agentile / s3-media-storage Goto Github PK
View Code? Open in Web Editor NEWWordPress Plugin to store and serve media library assets using Amazon S3
WordPress Plugin to store and serve media library assets using Amazon S3
Im getting: S3::getBucketLocation(my-bucket): [AccessDenied] Access Denied
error, I have added both required keys, what am I doing wrong!
My apologies. I solved my issue and no longer need help.
Great plugin! It works beautifully.
Cheers,
Angela
I changed add_options_page in admin.php to:
add_options_page('S3 Media Storage', 'S3 Media Storage', 'manage_options', 'S3MSAdminMenu', 'S3MSAdminContent');
That way I was able to view the Option in Settings. (wordpress 3.8.1)
Thanks for this awesome plugin!
When I set up the Cloudfront domain name setting, I used the internal name (.cloudfront.net/) instead of cdn.example.com/*. I uploaded the first batch of files before I realized my mistake. Now, a bunch of files have the internet URL path instead of the nicer URL.
Could you add a rewrite feature to fix the names of previously uploaded files when the Cloudfront setting changes?
Thanks!
I noticed this bit in the code, and am wondering if you could explain what the hurdle is here in a little more detail.
// We can't hook into add_attachment/edit_attachment actions as these occur too early in the chain as at that point in time,
// metadata for the attachment has not been associated. So we want to wait, so we can handle both and then delete the local uploaded file.
// add_action("add_attachment", 's3_update_attachment');
// add_action("edit_attachment", 's3_update_attachment');
I'm getting very random results uploading media--sometimes it uploads, transfers to S3 bucket & changes the URL to my couldfrount domain and sometimes it doesn't. Sometimes I get an http error when I upload. Even with the http error, sometimes it still uploads the photo, transfers it to S3 & changes the URL, sometimes it doesn't. I haven't figured out any pattern to it. I have turned off all plugins and used a default theme, and have the same results. If I turn off the plugin, I don't get the http error uploading media.
At first I thought I always had to tell the plugin to manually transfer the images until I asked on your blog and you said it should do it automatically. When I do manually tell the plugin to transfer them, it doesn't change the URL in the post (maybe it's not supposed to). And if I use something like Velvet Blues Update URLs to change the URLs in the posts, it shows part of the URL duplicated in the S3 media page settings. But if I look through the database, the URLs aren't duplicated like that.
For example, after I change the URLs with the Velvet Blues Update URL plugin, on the S3 Media settings page, it'll show the S3 file as https://d2k2naxhvn4zw5.cloudfront.net/blog/wp-content/uploads/http://d2k2naxhvn4zw5.cloudfront.net/blog/wp-content/uploads/2014/03/TraciBunkers.com-031214-journalpage.jpg
If I turn off the plugin, then none of the thumbnails show for the images that I uploaded or transferred using the plugin unless I turn on W3 total cache. But even with W3 TC on, the thumbnails in the media library still don't show in the admin unless I turn the plugin back on. I've been doing all these tests without W3 TC on, but noticed it helped with the thumbnail issue if I turned it on.
So, as you can see, I'm having issues.
I'm using WP 3.8.1 and my site is hosted on a server that uses CloudLinux (in case that makes a difference).
WordPress 4.5 generates srcset
for images, however S3-Media-Storage does not handle that. It would be awesome to support that!
I've just updated to wordpress 4.3.1, and the thumbnails for posts don't show, but the full images on the posts do. Everything else seems to be working fine.
In looking at the page source, the URL has my cloudfront URL, but it's also duplicating part of the URL from the original source, such as this:
https://MY-CLOUDRONT-DOMAIN.cloudfront.net/blog/wp-content/uploads/https://www.MY-SITE/blog/wp-content/uploads/2014/04/IMAGE-NAME-124x150.jpg
And it should just be:
https://MY-CLOUDRONT-DOMAIN.cloudfront.net/blog/wp-content/uploads/2014/04/IMAGE-NAME-124x150.jpg
I updated the plugin to the new version 1.0.3, made the change in admin.php so I could see the settings, but I'm still having http errors and the files aren't automatically transferring. I think I mentioned this before-- when I try to upload an image and get the http error, although it does upload to my media library, the thumbnail doesn't show. When I turn off the plugin, I can upload w/ no problem & see the thumbnails in the media library. But for the images I've transferred to S3 with the plugin, those thumbnails don't show in the admin or on my site.
can we do anything to upgrade this plugin and make it compatible for multisite.
Or should we clone the project and create a specific multisite plugin?
Trying to use a bucket at the new Frankfurt data centre and getting this error message:
Could not connect to bucket with the provided credentials!
S3::getBucketLocation(degrisogono): [InvalidRequest] The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.
Don't see any option to select the authorization mechanism used by the plugin. Any suggestions are welcome.
Thanks
Hi,
Great plugin, however i have to add in filters and hooks myself. Was thinking that maybe we can decide on some basic filters and hooks for this plugin so its easy for people to further enhance on this plugin's capabilities. In my case i need to know when a file is uploaded to media library / S3.
Let me know what you think, i can submit a PR, once we decide on what hooks should be appropriate.
Thanks.
In admin.php on line 6:
add_options_page('S3 Media Storage', 'S3 Media Storage', '4', 'S3MSAdminMenu', 'S3MSAdminContent');
The "4" is causing WP to throw a deprecated warning. You should change this to a capability, I changed it to 'edit_files' as that's an admin/superadmin level, but it can be anything that seems right.
add_options_page('S3 Media Storage', 'S3 Media Storage', 'edit_files', 'S3MSAdminMenu', 'S3MSAdminContent');
When uploading via the media library, all image meta data (thumbnail sizes) are lost, the resized images are uploaded to cloudfront, but the meta data does not exist, See example:
[thumbnail] => https://xxxxxxxxxxxxx.cloudfront.net/2014/07/
[thumbnail-width] => 150
[thumbnail-height] => 150
[medium] => https://xxxxxxxxxxxxx.cloudfront.net/2014/07/
[medium-width] => 300
[medium-height] => 199
[large] => https://xxxxxxxxxxxxx.cloudfront.net/2014/07/
as you can see the image path is not complete.
DATABASE: {s:9:"thumbnail";a:3:{s:4:"file";s:0:"";s:5:"width";i:150;s:6:"height";i:150;}
I believe this is because line 58 of s3-media-storage is:
$bucket_path = isset($custom_fields['S3MS_bucket_path']) ?
$custom_fields['S3MS_bucket_path'][0] : null;
This will always return true, I believe, because you are creating the meta field regardless of it having a value on line 230 of s3-media-storage.php:
update_post_meta($attachment_id, "S3MS_bucket_path", $settings['s3_bucket_path']);
The get_post_custom
key 'S3MS_bucket_path' referenced by the first block will contain an empty array, and will therefore evaluate to true. Which means that lines 93 and 99 will always be used to build the path:
http://my.bucket.s3.amazonaws.com//dork.jpg
Amazon, in this case, adds a directory with no name to your bucket, and, indeed, you can call the images from there if you paste that URL into your browser bar, but it seemingly breaks the media library as that set of double-slashes is ignored by the browser, php or wordpress, or some combination thereof, and
http://my.bucket.s3.amazonaws.com/dork.jpg
does not exist. That's what I'm guessing is happening, anyway.
Thanks for the work on this plugin!
I'm making changes in my site and want to stop using the plugin. I've got all of my images on Amazon S3 and not on my serve. Deactivating the plugin causes all of my images to be broken. I think the plugin inserts code into the database options that are specific to the plugin. What do I need to change in the database for my images to work without the plugin active?
It seems you are no longer maintaining the plugin, so I hope you will help me out.
Platform : WP 3.9.2 + WooCommerce
Have around 30,000+ files in existing Uploads folder and all these files already exist in a S3 Bucket, if this bucket name is specified in plugin config, plugin doesn't return file listing confirming existence of any files in this particular S3 Bucket, only shows list of files in WP Uploads folder.
Therefore, created a new Bucket in s3 and setup a new Cloudfront distribution with the intention of uploading contents of Uploads folder via this Plugin. Once the config was in place, plugin returned a list containing 100 files from uploads folder and similar file lists in subsequent 338 pages. All files selected on page-1, clicked "Move files to S3", got message 100 files Moved but the S3 bucket is empty while these 100 files still exist in Uploads folder. Not getting even any error messages.
Assistance in resolving this would be highly appreciated and tips to utilize the 30,000+ in existing S3 bucket without having to manually upload these again will be of immense help.
I've got this up and running and it's working great so far in my testing. I have an existing site with several gigs of data that I'll hopefully be able to move to S3 and remove from my web server. I have a question regarding if we were to ever revert from using this plugin/S3/Cloudfront in the future. I noticed when I disabled the plugin that the urls to cloudfront remained on my tests. Is it possible to return all those values back to their original WP url given that the media is still (or copied) back on the server? Hopefully we would never have to do this but I'm just trying to walk through all the possibilities before going all in.
Thanks again for all your work on this plugin and for providing support.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.