• Resolved jamieburchell

    (@jamieburchell)


    Reading through the threads here there are several topics that keep coming up – what happens on uninstall and how to delete generated images. One idea might be to store the webp images in a dedicated directory which matches the path structure of the original. I’ve seen other plugins do the same and always thought it quite neat that it keeps the converted images away from the originals and makes uninstalling/deleting/clean up easier.

Viewing 3 replies - 1 through 3 (of 3 total)
  • WolfgangHammersmith

    (@wolfganghammersmith)

    Just a heads up. The latest plugin version has a delete function and it creates the files with the original name + the .webp extension added on making it easy to tell which file was the original.

    Technically the safest solution is to make a directory and put only optimized images into that directory, but how to choose a unique directory base name that is not in use?

    Perhaps take all the extra vowels out of ‘imageoptimize’: ..site_root/imgoptmz/ ...?
    Actually that could be unique and short enough?

    If the plugin can then mirror the existing website directory structure inside that unique base directory for storage it would keep everything tidy with low risk of issues.

    Actually, rsync can do the directory mirror in a single command: rsync -av --include='*/' --exclude='*' source_dir/ destination_dir/

    Thread Starter jamieburchell

    (@jamieburchell)

    How about using the plugin name? wp-content/images-to-webp/...

    Plugin Author kubiq

    (@kubiq)

    No, sorry, this will probably never happen.

    We can not create separate folder inside wp-content because this plugin can change images also in folders outside of this one and there are some special WP installations like Bedrock or others that can store all the uploads on a completely different place.

    If you need to delete WebP images, then just run some SSH command, eg.:
    find . -type f -name "*.webp" -exec bash -c 'if [ -f "${1%.webp}" ]; then echo "Deleting $1"; rm "$1"; fi' _ {} \;

    This will find all the WEBP images and delete them only when similar file without .webp extension exists in there too

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Suggestion: Store WEBP images in a dedicated directory’ is closed to new replies.