Support » Plugins and Hacks » [Plugin: W3 Total Cache] CDN Image Uploads

  • Resolved Alex Rodriguez

    (@alexrodriguez)


    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-150×150.jpg, wp-created-199×300.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-150×150.jpg and wp-created-199×300.jpg to the CDN.

    Any help/suggestions will be appreciated.

    Alex

Viewing 12 replies - 1 through 12 (of 12 total)
  • 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

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

    This is fixed in the next release coming shortly.

    Great! I eagerly wait for its arrival.

    Thank you for this great plugin!

    Alex

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

    Got it! Its working great. Thanks again!

    You’re welcome.

    I’m having the same problem. The images appear to be renamed on Cloudfront (they all have 220×146 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.

    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…

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

    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!

    Excellent.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: W3 Total Cache] CDN Image Uploads’ is closed to new replies.