• Resolved Jon

    (@jon1wt)


    Hello

    I have a problem with the filter “webpc_uploads_webp” for requirements reasons I need the path to be the same as the normal images, everything worked fine until the last update, now it shows me this message

    The path for / uploads files does not exist (function is_dir () returns false). Use filters webpc_uploads_root or webpc_uploads_path to set the correct path. The current using path is: / var / www / html // wp-content / uploads. Please read the plugin FAQ to learn more.

    I do not know if I have to modify something I have the filter that returns

    return 'wp-content/uploads';

    Thanks for the help

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @jon1wt,

    Thank you for your message.

    What exactly filters do you use? Does the path given in the error message exist? If not, what is the correct one?

    Thread Starter Jon

    (@jon1wt)

    Hi @mateuszgbiorczyk

    I am using this filter

    add_filter ('webpc_uploads_webp', function ($ path) {
         return 'wp-content/uploads';
    });

    and I have not modified it since the first time I installed the plugin, the path should be the same, what I see in the message is it has double // before the wp-content

    • This reply was modified 5 years, 9 months ago by Jon.
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Please add the following code to your theme:

    <?php
    
      add_action('init', function()
      {
        echo '<pre>';
          print_r([
            'webpc_uploads_root'  => apply_filters('webpc_uploads_root', ABSPATH),
            'webpc_uploads_path'  => apply_filters('webpc_uploads_path', ''),
            '_webpc_uploads_path' => apply_filters('webpc_uploads_path', '', true),
            'webpc_uploads_webp'  => apply_filters('webpc_uploads_webp', ''),
            '_webpc_uploads_webp' => apply_filters('webpc_uploads_webp', '', true),
          ]);
        echo '</pre>';
        exit;
      });

    Please send me what is displayed to you. Please also go to FTP, the /wp-content directory and take a screenshot so that I can see the directory structure and current path.

    Thread Starter Jon

    (@jon1wt)

    The code display this

    Array
    (
        [webpc_uploads_root] => /var/www/html/
        [webpc_uploads_path] => /var/www/html//wp-content/uploads
        [_webpc_uploads_path] => wp-content/uploads
        [webpc_uploads_webp] => /var/www/html//wp-content/uploads
        [_webpc_uploads_webp] => wp-content/uploads
    )

    the reason i need the files to be in the same directory is because they are sent to a s3 bucket

    this is a screenshot of last month’s folder and you can see a file and the webp version

    screenshot

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Try using the webpc_uploads_root filter to set the correct path. Are the files in the media library on the same server as the other website files?

    Thread Starter Jon

    (@jon1wt)

    I am going to try the filter you are commenting on, is the same function just change the name or do I need to use both filters?

    about the files, the website files are separated, the bucket is only for the uploads folder

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    This filter applies to both /uploads and /uploads-webpc. Try using only this filter. Using the webpc_uploads_webp filter, you cannot set the same path as the original files. It is impossible.

    Thread Starter Jon

    (@jon1wt)

    I’m still trying to get it working but still can’t make it, I use the filter like this example

    add_filter('webpc_uploads_root', function($path) {
        return 'n';
    });

    but create the “n” folder inside the wp-admin folder

    Any ideas how I could make webp files create inside the “wp-content/uploads” folder along with the original files?

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    You provide the full server path in this filter. You cannot choose the same folder for WebP files as for /uploads.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Problem changing the phat’ is closed to new replies.