WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: W3 Total Cache] image gallery not working with cdn enabled (18 posts)

  1. sqlwiz
    Member
    Posted 4 years ago #

    I'm working on implementing the latest w3tc in a wpmu site and it looks great.

    The CDN Type is "Origin Push / Self-hosted (File Transfer Protocol Upload)". The "export media library to CDN" option ran fine. Most media is working fine with CDN enabled.

    We've got a number of posts that use the [gallery] tag. Images are uploaded using the "Add media:" option, "Link URL" is set to "None". "File URL" type links are generated by default for gallery items when viewing the site.

    The galleries work with the CDN disabled, but stop working with the CDN enabled.

    The file urls are a mess by default and I suspect the Apache server running wordpress is fixing them and that the asset host does not know what to do with the urls. The urls have the following format:

    http://www.domain.org/wpmu/blogname/files//usr/filesys/htdocs/wpmu/blogname/wp-content/blogs.dir/blogid/files/yyyy/mm/image_1.jpg

    I really cannot add file urls manually to all the gallery images. Can you suggest a way to deal with this problem?

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. Frederick Townes
    Member
    Posted 4 years ago #

    The plugin cannot automatically upload your gallery changes. You need to make sure that the path to your gallery files is added to the custom files list and that you export those to CDN. Then you should see them work.

  3. sqlwiz
    Member
    Posted 4 years ago #

    Hi Frederick,

    I don't believe we've made any changes. Having said that, I've just seen different (normal) behavior in another install, so I'll have to research the current settings and plugins.

  4. Frederick Townes
    Member
    Posted 4 years ago #

    Ok

  5. Chukwudi Emmanuel Udegbunam
    Member
    Posted 4 years ago #

    @Frederick Townes: Hi sir, I finally managed to export my gallery to the CDN. Now my problem is that I blog with Windows Live Writer.

    How do I set Windows Live Writer to upload images of new blog posts to the CDN?

    My CDN is images.strictlyonlinebiz.com.
    Thanks a lot!

  6. Frederick Townes
    Member
    Posted 4 years ago #

    To be honest, I'm not sure how to support this case because I've never used Live Writer. Does Live Writer work natively with the Media Library?

  7. Chukwudi Emmanuel Udegbunam
    Member
    Posted 4 years ago #

    It works natively with Windows Live Writer such that post images land in the wp-content/upload folder but there's an option to have it FTP the images to any other location which is why I'm kind of wondering how to set it up without having to export the media gallery after each new post. Thanks anyway ;)

  8. Frederick Townes
    Member
    Posted 4 years ago #

    Unfortunately, without auto-upload I cannot support this case.

  9. sqlwiz
    Member
    Posted 4 years ago #

    To wrap up the initial issue for anyone with a similar problem.

    We run wp-admin on a different server behind the firewall, therefore the file path stored in the attachment post meta data does not match the value of basedir for the blog when accessed by an external viewer.

    That is why we are seeing strange urls in the gallery at run time, but not in the admin. In addition, WordPress apparently fixes the urls when serving the files, since this was not a problem until we enabled the cdn. But it is not a w3-total-cache problem.

    The fix we implemented was a filter for "wp_get_attachment_url" to remove the file path inserted by the remote wp-admin.

  10. Frederick Townes
    Member
    Posted 4 years ago #

    Thanks @sqlwiz.

  11. Chukwudi Emmanuel Udegbunam
    Member
    Posted 4 years ago #

    @Fredericktownes: WLW issue resolved. It automatically recognises the CDN.

    My current problem now is that whenever I deactivate W3 TOTAL CACHE. I get 404 errors on ALL my blog posts. What could be wrong?

  12. Frederick Townes
    Member
    Posted 4 years ago #

    There might be directives from disk enhanced mode in the .htaccess file?

  13. Chukwudi Emmanuel Udegbunam
    Member
    Posted 4 years ago #

    The code below appears in my htaccess

    # BEGIN W3 Total Cache
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{REQUEST_URI} !\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register).php [OR]
        RewriteCond %{REQUEST_URI} wp-comments-popup\.php|wp-links-opml\.php|wp-locations\.php [NC]
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{QUERY_STRING} =""
        RewriteCond %{HTTP_COOKIE} !comment_author|wp-postpass|wordpress_\[a-f0-9\]\+|wordpress_logged_in [NC]
        RewriteCond %{HTTP_USER_AGENT} !bot|ia_archive|slurp|crawl|spider|2\.0\ MMP|240x320|ASUS|AU-MIC|Alcatel|Amoi|Android|Audiovox|AvantGo|BenQ|Bird|BlackBerry|Blazer|CDM|Cellphone|DDIPOCKET|Danger|DoCoMo|Elaine/3\.0|Ericsson|EudoraWeb|Fly|HP\.iPAQ|Haier|Huawei|IEMobile|J-PHONE|KDDI|KONKA|KWC|KYOCERA/WX310K|LG|LG/U990|Lenovo|MIDP-2\.0|MMEF20|MOT-V|MobilePhone|Motorola|NEWGEN|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Novarra|O2|Opera\ Mini|Opera\.Mobi|PANTECH|PDXGW|PG|PPC|PT|Palm|Panasonic|Philips|Playstation\ Portable|ProxiNet|Proxinet|Qtek|SCH|SEC|SGH|SHARP-TQ-GX10|SIE|SPH|Sagem|Samsung|Sanyo|Sendo|Sharp|Small|Smartphone|SoftBank|SonyEricsson|Symbian|Symbian\ OS|SymbianOS|TS21i-10|Toshiba|Treo|UP\.Browser|UP\.Link|UTS|Vertu|WILLCOME|WinWAP|Windows\ CE|Windows\.CE|Xda|ZTE|dopod|hiptop|htc|i-mobile|iPhone|iPod|nokia|portalmmm|vodafone [NC]
        RewriteCond /home/mogbn/public_html/blog/wp-content/w3tc/pgcache/%{HTTP_HOST}/$1/index.html%{ENV:APPEND_EXT} -f
        RewriteRule (.*) wp-content/w3tc/pgcache/%{HTTP_HOST}/$1/index.html%{ENV:APPEND_EXT} [L]
    </IfModule>
    # END W3 Total Cache

    Will deleting it stop the 404 errors. I just want to confirm should in case at some point in time I need to uninstall the plugin.

  14. Frederick Townes
    Member
    Posted 4 years ago #

    If plugin disabled, those rules should be removed otherwise you will have unexpected behavior.

  15. Chukwudi Emmanuel Udegbunam
    Member
    Posted 4 years ago #

    Thanks a million ;)

  16. Frederick Townes
    Member
    Posted 4 years ago #

    You're welcome.

  17. aero7
    Member
    Posted 4 years ago #

    hi there. I have a problem with this plugin. I have exported all media files to my new custom CDN location, but it looks like not all files are imported, maybe just half of them for some reason. I uploaded them all manually to the new locations, but still there are pictures in almost all of my posts with invalid links.

    I rightclick and choose view image then I'm presented with a 500 server error. I know the files are there cause I uploaded them manually, but I can't access them

    I would appreciate some help on this :)

    Thanks for reading

  18. Frederick Townes
    Member
    Posted 4 years ago #

    That's not enough information to trouble shoot. Images etc have nothing to do with a 500 internal server error, so I'm not clear on what's going on. If you uploaded images elsewhere and the upload was successful, you should be able to simply open the image in your browser, isn't that the case?

Topic Closed

This topic has been closed to new replies.

About this Topic