Giter Site home page Giter Site logo

deliciousbrains / wp-amazon-s3-and-cloudfront Goto Github PK

View Code? Open in Web Editor NEW
304.0 304.0 148.0 16.11 MB

Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.

Home Page: https://wordpress.org/plugins/amazon-s3-and-cloudfront/

JavaScript 48.73% CSS 0.68% PHP 42.25% Hack 0.01% SCSS 3.28% Svelte 5.04%

wp-amazon-s3-and-cloudfront's People

Contributors

a5hleyrich avatar bradt avatar datacoda avatar dberube avatar eriktorsner avatar etcook avatar gilbitron avatar gmauricio avatar ianmjones avatar mcfarlan avatar polevaultweb avatar taras 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-amazon-s3-and-cloudfront's Issues

Add the ability to change cloudfront host depending of the protocol

Hi, thank you for this great plugin.

Would it be possible to change cloudfront host depending of the protocol?

I would like to use a custom CNAME like "images.mysite.com" when the images are displayed with HTTP but use the cloudfront distribution domain name (dxxxxxxx.cloudfront.net) when the images are displayed with HTTPS.

This is because cloudfront distributions don't support custom SSL certificates and only have their own one. So if I want to display an image with my custom CNAME over SSL I will get an SSL error as the cerficate hostname doesn't match.

Thank you and again congrats for you plugin.

Support image regeneration

Most third-party regeneration plugins seem to call get_attached_file which obviously currently fails on file_exists since the file is no longer local.

How hacky would it be to create a local stub and add a filter that function? Subsequent calls to wp_generate_attachment_metadata would have to pull-down from S3, rebuild and reupload of course. RFC

HTTPS

I found that when I use plugin in HTTPS, it looks for resources in a domain that is:

$domain_bucket = 's3.amazonaws.com/' . $s3object['bucket'];

Actually this causes an error:

<Error>
<Code>PermanentRedirect</Code>
<Message>
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
</Message>

Probably AmazonAws changed the way to browse bucket in SSL and you're going on considering a different behavior.
Anyway it would work if you change this line of code with: $domain_bucket = $s3object['bucket'] . '.s3.amazonaws.com'; (amazon-s3-and-cloudfront.php, line 336).

Uploading to bucket root instead of wp-content/blogs.dir/1/files/

Hi, thanks for letting us use s3 to host our uploaded files!

When trying out this plugin in our multisite environment, I can't find out how to prefix uploaded files with the configured upload path per site, which means the different sites may overwrite each other's files.

When a site's upload path is configured as wp-content/blogs.dir/1/files/ and I upload somefile.ext, I want it to end up like <bucket>/blogs.dir/1/files/somefile.ext. Instead it ends up like <bucket>/somefile.ext.

Is there a simple configuration to enable this that I've overlooked?

Object Path Question

I am trying to determine why this sub folder structure was added to the Object Path and how can I remove it or change it (or reset it)?

object_path

Thanks for the assist!

Time error

But with this script, I have a problem. The fact is that I have no way to change the time zone on the server. what to do in such cases, how to deal with the problem?. I will be glad to hear what you think about it.

P.S. Sorry for my bad English

Update guid in wp_posts table for images removed from local filesystem

It seems the wp_posts table is not updated for images, even when the "Remove uploaded file from local filesystem once it has been copied to S3 " setting is in effect. Ideally the "guid" field in the wp_posts table would be updated to reflect the correct location of the image file.

Mismatch between local upload directory structure and S3 directory structure

When a file is uploaded to WordPress through a post and month/year organization is enabled, the file is uploaded into the month and year directory corresponding to the post's publish date. However, the plugin puts the file in the month and year directory corresponding to the time when the file was uploaded. Can the plugin match the location WordPress uses?

S3 Access Denied - keys are fine

I get this error when trying to upload an image:

Jan 20 17:14:33 dev apache2[4194]: [error] [client 192.168.33.1] Error uploading $IMAGE to S3: Access Denied, referer: $MYBLOG/wp-admin/post-new.php

I've confirmed that the keys I'm using have the right permissions:

aws s3 cp foo s3://$MYBUCKET/foo

They also do work when listing buckets in the plugin configuration. My bucket's region is US Default.

Is there some way to get more error information out of the plugin?

Save resource with Protocol Relative URL

Hello,
the setting "Always serve files over https (SSL)" might be removed and instead, the urls would be saved without the schema part (Protocol Relative URL):

http://www.example.com/images/example.png

would be saved as

//www.example.com/images/example.png

Then the resource will be requested with the same protocol the page was.

This way, you have not to make a decision beforehand, and I think it works fine in almost every browser.

Thanks for your great work!!!

Upload specific filetypes to S3 only

I'm using Aqua-Resizer which only allows images to be resized on the server in the uploads folder. It doesn't allow any external images. This functionality is built into my template unfortunately. I'm also serving video files as .mp4, .ogg and .webm. And I love your S3 plugin.

Is it possible to exclude .jpg and .png from being uploaded and linked to S3?

Incompatibilities with WooCommerce Dynamic Gallery PRO

There are several issues with this plugin

  1. it is not compatible with WooCommerce Dynamic Gallery PRO and image uploads fail (no error) they just fail

  2. sometimes image upload simply sticks at 100% , closing window and opening media window shows the image did upload

  3. when inserting an image into blog using shortcode or plugins the image always scales to full size rather than selecting correct size image

  4. Periodically it fails when trying to insert image directly from S3, interface just closes for no apparent reason

I love the plugin but these issues and minor possible bugs need ironing out

I have tested it on 3 sites running different themes and versions of woocommerce and WP same issues repeat

http://wordpress.org/extend/plugins/amazon-s3-and-cloudfront/

one final note, i would rather have support via wordpress as it is easier for newbies to see and fix what issues others have, as it makes the plugin look bad if none of the support threads are answered, I for one usually ignore plugins if the support threads go unanswered as this gives the impression the plugin developer does not care, it was only after posting the support thread I noticed yo prefer github, but that means I have yet another support forum to join adding to the extensive list I have to remember if there is a problem :)

Manually moved over entire existing media library, need to update paths

So I know alot of people have asked if this plugin can migrate their files over to S3 I'm not asking that. I've already done that by just manually downloading my entire wp-content/uploads directory then moving that to my S3 bucket. I've also gone in and changed all my meta values for posts that have wp-content/uploads to take into account my cloudfront address.

HOWEVER

I'd like all my existing images that I've now migrated over in the Media Library to point to S3 like new images do.

Is there any way to go about this?

Remove local file after uploading to S3

Is is possible to not save a copy of the file(s) locally? I'm looking for a way to upload a podcast to S3 and would like to not have a copy on the web server.

S3 upload delay

Is there any way to delay the 'copy to S3' process by x min/hrs ?

We have some automatic tasks which happen to files directly after it is uploaded to the media library, ie video conversions, etc. Although the upload to S3 process is working it's catching the wrong versions of the files.

Can't use a different bucket than the first selected one

Hi,
I have two websites hosted on Amazon Opsworks, the first one has this plugin set up and uploads media to an s3 bucket no problem. When setting up the second one, all uploads silently fail.

As soon as i set the second site to use the same bucket as the first site, it works. If i use a different Amazon account and upload to the first bucket it works. If i create a second bucket on that other Amazon account, uploads fail without any error message.

Is bucket selection broken?

Edit: Permissions on the buckets are the same.

Predefined bucket

Ability to predefine bucket rather to force the selection of a particular bucket and the use of a certain cloudfront domain, perhaps by adding these lines: define('AMAZON_S3_BUCKET', 'BUCKET1');
define('AMAZON_CLOUDFRONT_DOMAIN', 'domain2.cloudfront.net');

Errors upon installing (probably theme-related)

I just installed this plug-in for the first time. As soon as I activate it, I get a whole host of errors, all of which look like they are unique to my theme:

Deprecated: Assigning the return value of new by reference is deprecated in /home/davidd3/public_html/dd2014c/wp-content/themes/surreal/framework/php/boot.php on line 35

Deprecated: Assigning the return value of new by reference is deprecated in /home/davidd3/public_html/dd2014c/wp-content/themes/surreal/framework/php/PeGlobal.php on line 72

Deprecated: Assigning the return value of new by reference is deprecated in /home/davidd3/public_html/dd2014c/wp-content/themes/surreal/framework/php/PeTheme/PeThemeGallery.php on line 554

Deprecated: Assigning the return value of new by reference is deprecated in /home/davidd3/public_html/dd2014c/wp-content/themes/surreal/framework/php/PeTheme/PeThemeData.php on line 15

Deprecated: Assigning the return value of new by reference is deprecated in /home/davidd3/public_html/dd2014c/wp-content/themes/surreal/framework/php/PeTheme/PeThemeData.php on line 68

Notice: Undefined index: se_research_metabox in /home/davidd3/public_html/dd2014c/wp-content/plugins/search-everything/search-everything.php on line 64

Does this mean the plug-in won't work with my theme (which I know uses a custom resizer -- the Aqua one)?

Image linking issue

when products are shown as thumbnails of 150px x 150px it should link to the image of the cropped size, but it is linking to the full size image and changing the size using the styling, so effectively it is loading a full size file image and slowing site down

when the plugin is deactivated then the images link to correct size

any ideas ?

Using woo, wp3.6.1

Requirement to keep original image?

Hi there,

Thanks for your work on this plugin.

The main reason I wanted to offload images to S3 was to save lots of space on our server. After much detective work it seems that I can manually delete all Wordpress resized images from my server, but not the original image. If I delete the original images (which my site isn't actually using anywhere) my template throws PHP errors where the images should be. Soon as I reinstate the original images all is fine, even though the images being referenced on S3 are resized versions.

Is there a requirement to keep the original images? Or is something amiss?

Thanks for your help.

Dave

Unable to get it to work.

Hi,

I installed both plugins, I added the two keys in the wp-config(I think this is a great idea,). I am able to select the bucket.

The issue is when I upload a file it does not display in my s3 bucket.

What can I do to test for the issue?

I have WP_DEBUG on and I see no errors. These are my server details:

    ** SERVER DATA **
PHP Version:                5.4.19
MySQL Version:              5.5.31-log
Server Software:            Apache/2.2.24 (FreeBSD) DAV/2 mod_ssl/2.2.24 OpenSSL/1.0.1e mod_hcgi/0.9.4

    ** PHP CONFIGURATION **
Safe Mode:                  No
Memory Limit:               256M
Upload Max:                 16M
Post Max:                   16M
Time Limit:                 30
Max Input Vars:             1000
Display Errors:             On
Sessions:                   Disabled
Session Name:               PHPSESSID
Cookie Path:                /
Save Path:                  /tmp
Use Cookies:                On
Use Only Cookies:           On
FSOCKOPEN:                  Your server supports fsockopen.
cURL:                       Your server supports cURL.
SOAP Client:                Your server has the SOAP Client enabled.
SUHOSIN:                    Your server does not have SUHOSIN installed.

Multiple CDN domains

It would be great to be able to add different CDN domains to load more resources in parallel. Is this already supported?

Thanks

Hundreds of duplicates

We have two servers running behind a load balancer. When we upload an image into the media galley, it successfully puts the file up on S3 and changes the URL for the image, which is great.

The problem is that it doesn't stop uploading the images and makes hundreds of duplicates. It keeps uploading copies until I restart my app server. It just keeps appending 1's on to the file name, as you can see in the screen shot below.

Screen Shot 2013-03-15 at 10 26 04 AM

My guess is that it has something to do with putObjectStream and a loop, but I haven't been able to pin point the source of the problem.

Thanks!

Multisite: support for per-site settings

A great plugin first ... I was more than happy to see new version supporting multisite, etc.

Anyway I found something that missing with multisite addons. For example if you mapping domain names with http://wordpress.org/plugins/wordpress-mu-domain-mapping/ and want to have different bucket and CloudFront for every domain.

Example buckets:
domain1.s3.amazonaws.com
domain3.s3.amazonaws.com
domain2.s3.amazonaws.com

Then corresponding cloudfront distributions with their domain names:
cdn.domain1.com
cdn.domain2.com
cdn.domain3.com

Having this will have this plugin complete solution. I am also happy to contribute codding this if it's not planned or implemented yet.

Multi-Site Support

Would it be possible to add an option for multi-site support? The site_id would have to be added to the /files/ path of the media URL. I am seeing wordpress-mu- referenced in the wordpress-s3.php file but am not sure how to make it work effectively.

Upload to S3 custom path

I use the same bucket for multiple kind of files, so I'd like to be able to upload my media in a /img folder, not in the root.

Thanks! :)

Add ability to transfer files uploaded outside the Media Library (on the front end or through other plugins)

Thanks for the great plugin. It works great for me on DreamHost shared hosting for normal uploads through the Dashboard Media Library.

Would it be possible to support transferring files that are uploaded by other means? For example, I'm using the WooCommerce Product Add-Ons Extension, which allows site visitors to upload files on the front end without logging in. It uses the wp_handle_upload() function for this. Files uploaded this way neither get transferred to S3 nor get their URLs redirected (or I'm doing something wrong). Is there some way I can hook into the S3 plugin to make this happen, and/or would it be possible to add this as a feature in future versions?

Virtual hosting issue? Content not copying.

FYI: I'm using Wordpress 3.6b2, and if you aren't interested in this please close out this issue and there will be no hard feelings!

The plugin can authenticate correctly from the looks of it, but if I tick the box that says "bucket is set-up for virtual hosting" it complains that my DNS is wrong and that I need a CNAME for my host.dom.tld to point to media.kvet.ch.s3.amazonaws.com.

My bucket: media.kvet.ch
My DNS currently (I've tried it both/many ways) for media.kvet.ch:

$ host media.kvet.ch
media.kvet.ch is an alias for media.kvet.ch.s3-website-us-east-1.amazonaws.com.
media.kvet.ch.s3-website-us-east-1.amazonaws.com is an alias for s3-website-us-east-1.amazonaws.com.
s3-website-us-east-1.amazonaws.com has address 205.251.242.203

If I make the CNAME for media.kvet.ch point to media.kvet.ch.s3.amazonaws.com, I don't think that's supposed to work โ€” if I enable website hosting on that bucket in S3, it will expect HTTP requests for objects to be against the bucket endpoint at media.kvet.ch.s3-website-us-east-1.amazonaws.com.

Consequently (?), this plugin isn't uploading data to S3 nor serving files via S3 and I'd like to fix that!

option to serve HTTPS via CloudFront

This plugin has been working great for me, thanks for that. The one thing I'd like to see is an option to use/generate https references instead of just http. CloudFront will serve via the exact same URL, just change http to https.

this would allow people to use SSL certs on their wordpress site and not get a mixed content (secure and non secure) warning.

Duplicate files and deletion issue

I am using your plugin and for the most part it seems to work great, however I am running into an issue that will be a big problem in my multiuser environment.

If an item called "fish.jpg" is uploaded to the site, and then another separate file with the same name "fish.jpg" is uploaded to the site that second file on the S3 side will simply replace the original fish.jpg file. Now on the wordpress library side, it still shows two items with the name fish. Now if I am to delete one of the fish items from the library, the other fish item will remain but with the missing image link.

It would work way better if that when uploading a second file to the media library with the same name, instead of simply deleting old file, the new file upload would be called "fish_copy1.jpg" (and generating thumbnails reflecting the new name ie fish_copy1-150x150.jpg)

This would make it much easier on the user and eliminate these deletion errors.

Is this a quick update that could be made? Thanks!

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.