WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: W3 Total Cache] CDN Image Uploads (13 posts)

  1. Alex Rodriguez
    Member
    Posted 4 years ago #

    Hi-

    I am having trouble using W3 Total Cache with Amazon CloudFront. Its all setup and my images (content) is transferred to the Amazon CDN however not ALL of the content is transferred.

    For example for every image I upload wordpress has three files they are wp-created-150x150.jpg, wp-created-199x300.jpg and original-upload.jpg. The only one I uploaded was the original-upload.jpg. The problem I am having is the W3 Total Cache is only sending the wp-created-150x150.jpg and wp-created-199x300.jpg to the CDN.

    Any help/suggestions will be appreciated.

    Alex

  2. ljg3
    Member
    Posted 4 years ago #

    I was having the same problem. I took a look through the code and it seems as though the way the upload functionality was written that it skips the original files now. Here's the code in particular, lib/W3/Plugin/Cdn.php starting at line 655:

    if (isset($metadata['file'])) {
    	$files = array_merge($files, $this->get_metadata_files($metadata));
    } elseif (!empty($post->file)) {
    	$file = $this->normalize_attachment_file($post->file);
    	$local_file = $upload_info['upload_dir'] . '/' . $file;
    	$remote_file = $upload_info['upload_url'] . '/' . $file;
    	$files[$local_file] = $remote_file;
    }

    I rewrote the logic so it always includes the main file, in addition to files found in the metadata:

    if (!empty($post->file)) {
    	$file = $this->normalize_attachment_file($post->file);
    	$local_file = $upload_info['upload_dir'] . '/' . $file;
    	$remote_file = $upload_info['upload_url'] . '/' . $file;
    	$files[$local_file] = $remote_file;
    }
    if (isset($metadata['file'])) {
    	$files = array_merge($files, $this->get_metadata_files($metadata));
    }

    After that, I had a much larger group of files uploaded, and everything seems to be working correctly. You could also make the change in the function that processes the metadata looking for files, but I'll leave that decision up to the plugin author.

    -Lew

  3. Alex Rodriguez
    Member
    Posted 4 years ago #

    hmm, that seems strange. I wonder if its a bug or an intentional feature?

  4. Frederick Townes
    Member
    Posted 4 years ago #

    This is fixed in the next release coming shortly.

  5. Alex Rodriguez
    Member
    Posted 4 years ago #

    Great! I eagerly wait for its arrival.

    Thank you for this great plugin!

    Alex

  6. Frederick Townes
    Member
    Posted 4 years ago #

    Meanwhile you can download the development release here and you should be all set: http://wordpress.org/extend/plugins/w3-total-cache/download/

  7. Alex Rodriguez
    Member
    Posted 4 years ago #

    Got it! Its working great. Thanks again!

  8. Frederick Townes
    Member
    Posted 4 years ago #

    You're welcome.

  9. photosensibility
    Member
    Posted 4 years ago #

    I'm having the same problem. The images appear to be renamed on Cloudfront (they all have 220x146 added just before .jpg). Why is this?

    If I download the plugin again, are you saying it's fixed (even though the version name hasn't changed from what I already have)? If I update the plugin, will I have to repeat uploading the media library, etc.?

    Or if I just wait, any idea how long before the next release?

    Thanks.

  10. photosensibility
    Member
    Posted 4 years ago #

    Hmm, if I want to apply just the fix for this problem, can I upload specific files (e.g., w3-total-cache.php)?

    I'm afraid that if I just drag and drop in the new version, I'll overwrite something that shouldn't be overwritten...

  11. Frederick Townes
    Member
    Posted 4 years ago #

    Files that are uploaded don't have to be re-uploaded. You should deactivate the previous plugin and install the development version.

  12. Alex Rodriguez
    Member
    Posted 4 years ago #

    Just remove or uninstall the one you have now and then install the development version.

    That is how I did it and it works great!

  13. Frederick Townes
    Member
    Posted 4 years ago #

    Excellent.

Topic Closed

This topic has been closed to new replies.

About this Topic