Support » Plugin: W3 Total Cache » [Plugin: W3 Total Cache] Deleting host server file shows blank image in media library

  • Resolved kg



    I use this plugin primarily to free up local (not CDN) host server space.

    Therefore, I delete local images after CDN upload. And I realise that I have to put something together to automate this manual process.

    1) Perhaps, add a setting that enables WP media library page to use CDN hosted images.

    2) Is there a meta value that holds the status of the image, e.g. Exists at CDN, Exists at CDN and Locally, Exists locally, Null = Not found. This could create the foundations for improved management of files.

    3) I see (as example) the hook into wp_generate_attachment_metadata has no priority, and another plugin I know of uses this hook too. I’m not sure which will run first (race condition?) and this is an area for concern.

    What do you think?

    Thanks in advance,

Viewing 5 replies - 1 through 5 (of 5 total)
  • Further,

    I created a hook for w3tc_cdn_add_attachment, where I remove certain files from being uploaded to CDN.

    There is now a situation where $files can be empty, and this will create an error down in Rscf.php at line 110 due to an empty array passed in.

    Therefore, for succesfull use of the w3tc hooks, I added a tweak to the upload function in w3-total-cache/lib/W3/Plugin/Cdn.php


    // kg: exit if no files are available to process
    if(empty($files)) return true;

    if (!$cdn->upload($files, $results, $force_rewrite)) {

    Hope this helps others.


    Plugin Author Frederick Townes


    I’m sorry, I’m not going to support this use case. Feel free to modify the plugin as you see fit, or find a more competitive host with greater disk space. This disk space is a non-issue among top tier hosts for the past couple years, not to mention multiple if not at least one backup of files is something I encourage.

    “I’m sorry, I’m not going to support this use case.”

    You miss the point. Where your hook filter is utilised, then the array can be passed back as empty, therefore, the solution I submit will prevent future headaches for anyone implmementing the hook and passing back an empty array. Plus it is only one line!

    kg, I am interested in doing something similar to what you have done, that is removing files from the host server after they have been uploaded. Is the one line edit you have provided all I need to be able to delete the files without breaking everything? Also, have you set up some kind of automated system to delete newly uploaded files, or do you do that manually.


    Plugin Author Frederick Townes


    Ok, thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: W3 Total Cache] Deleting host server file shows blank image in media library’ is closed to new replies.