• Resolved uarichs

    (@uarichs)


    Hello.

    How to add specific image to exceptions?
    A certain image (favicon png) is converted and a non-beautiful black background appears in it. I want to add this image to exceptions.
    What is the best way to do this?

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

    (@mateuszgbiorczyk)

    Hi @uarichs,

    Thank you for your message.

    First, remove this image from the /uploads-webpc directory (or this whole directory).

    Then add the following code to the functions.php file in your theme directory:

    add_filter( 'webpc_files_paths', function( $paths ) {
      $excludes_files = [
        'my-image.png',
      ];
      foreach ( $paths as $path_index => $path ) {
        if ( in_array( basename( $path ), $excludes_files ) ) {
          unset( $paths[ $path_index ] );
        }
      }
      return $paths;
    } );

    In the code, you can add your own filenames to block. Then start converting all images and those added in the code will not be converted.

    Thread Starter uarichs

    (@uarichs)

    Thank you!

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

The topic ‘Add specific image to exceptions’ is closed to new replies.