Title: Offloading Specific Paths
Last modified: October 9, 2024

---

# Offloading Specific Paths

 *  [flexn74](https://wordpress.org/support/users/flexn74/)
 * (@flexn74)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/offloading-specific-paths/)
 * First of all, thank you for allowing us to use such a great plugin for free. 
   I have a few questions.
    1. Is it correct that only the default path of the WP library, such as `example.
       com/wp-content/uploads/2024/10/`, is offloaded?
    2. I would like to offload the path `example.com/wp-content/uploads/buddypress/`
       Is there a way to do this?
 * Thank you again for providing such a useful plugin.

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

 *  Plugin Author [Anton Vanyukov](https://wordpress.org/support/users/vanyukov/)
 * (@vanyukov)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/offloading-specific-paths/#post-18066162)
 * Hi [@flexn74](https://wordpress.org/support/users/flexn74/),
 * Thanks!
 * Regarding your question. It’s not about the paths, it’s more about what’s tracked.
   The plugin hooks into the core WordPress functionality regarding images. If it’s
   part of the media library, then it should be offloaded.
 * BuddyPress, as far as I know, uses their own mechanism for managing media. It
   should be possible to offload such images (in theory), but I have never tested
   this. I will surely give this a go once I have a chance.
 * Best regards,
   Anton
 *  Thread Starter [flexn74](https://wordpress.org/support/users/flexn74/)
 * (@flexn74)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/offloading-specific-paths/#post-18066248)
 * Thank you for your response.
 * I misunderstood the options related to folder structure and thought that the 
   entire structure, including subfolders, would be uploaded to CF Images just as
   it is in the `uploads` folder. Then something like changing the domain in the
   actual image URL to `imagedelivery.net` and adding the appropriate parameters…
 * Anyway, **thank you for resolving my confusion**.
 * From the perspective of securing plugin users, I think Buddypress is a pretty
   large market 🙂
 * ++ Also, if you could share some ideas…
 * I created several Buddypress groups, and there are many image files in the following
   path:
 * `example.com/wp-content/uploads/buddypress/groups/5/cover-image/67068ba17ca38-
   bp-cover-image.webp`
 * To offload these files, which plugin file should I open, and in what direction
   should I modify it? 🙂
 *  Plugin Author [Anton Vanyukov](https://wordpress.org/support/users/vanyukov/)
 * (@vanyukov)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/offloading-specific-paths/#post-18066296)
 * This will be long, but I’ll probably pin this so that others can see my position
   on full offloading, why it’s not perfect with Cloudflare Images and how I see
   the future of the plugin.
 * With offloading, if you want to physically move the files away from the server–
   the safest option is one that allows you to have a one to one file mapping. For
   example, AWS S3 or Cloudflare R2 do this. The reason why Cloudflare Images are
   not great for offloading, is because it transforms the images in a way that it
   becomes complicated to track the mapping between the original vs offloaded.
 * Let’s use your example:
 *     ```wp-block-code
       example.com/wp-content/uploads/buddypress/groups/5/cover-image/67068ba17ca38-bp-cover-image.webp
       ```
   
 * When it is offloaded to Cloudflare R2, it is accessible via a custom mapped domain
   on R2:
 *     ```wp-block-code
       <custom domain>/wp-content/uploads/buddypress/groups/5/cover-image/67068ba17ca38-bp-cover-image.webp
       ```
   
 * Besides the domain, the URLs are identical. It’s very easy to do a search and
   replace on the site and switch over back and forth. If you wanted to restore 
   the image, you’d just download it.
 * Cloudflare Images, on the other hand, will use unique IDs and make the mapping
   extremely difficult. The default offloaded image URL will look something like
   this:
 *     ```wp-block-code
       https://imagedelivery.net/baIq1hwqwNPaTgiq1wy2LA/22d036a9-70cb-4151-a1a8-465c184e4200/public
       ```
   
 * This is especially a big issue for the WordPress media library, because the images
   have different attachment sizes, and if at some point the plugin is not able 
   to “parse” the page and find an image – you’ll get a 404. Moreover, there are
   various limitations on image sizes.
 * I have attempted to mitigate this by using custom paths instead of IDs (you can
   already toggle this feature on in the plugin settings), which will convert URLs
   to a better suited format for offloading, which looks something like this:
 *     ```wp-block-code
       https://imagedelivery.net/baIq1hwqwNPaTgiq1wy2LA/example.com/2024/01/image.jpeg/public
       ```
   
 * Still not ideal, but much better. I have taken this even further, and created
   a service that will create a Cloudflare worker that will convert the URL to something
   like this:
 *     ```wp-block-code
       https://example.com/images/example.com/2024/01/image.jpeg/public
       ```
   
 * Yes, the double `example.com` is not a mistake – Cloudflare Images don’t have
   a folder structure, so images need to be prepended with the origin domain name
   to be able to identify it (another issue, which I have solved in the plugin).
 * But even with all this, the problem with various attachment sizes has not yet
   been resolved (when WordPress generates a bunch of smaller images for the original).
   I thought about moving away from flexible variants and use physical ones, which
   Cloudflare definitely allows. But at the time of initial development, the variants
   were capped at something like 20 (don’t remember the exact number), point is –
   it wouldn’t have been enough for a lot of the sites. The other problem with variants
   is that flexible variants allow dynamic resizing, which in some cases allows 
   the plugin to serve exactly the image size that is required by the browser. No
   other plugin on the market is able to do this (don’t quote me on this). That’s
   why I’m hesitant to switch away from flexible variants.
 * However, flexible variants also have drawbacks – the image is cached only for
   an hour, which is visible on some page loads, where an image takes its time to
   appear on the page, and some users have reported this, which, unfortunately, 
   I can’t address as it’s a Cloudflare limitation.
 * Ideally, at some point I want to add an option that allows the user to setup 
   either flexible variants or the normal ones, or add support for Cloudflare R2.
   But all this takes time.
 * Hope this explains everything. And to answer your question on which plugin to
   use, sorry that it’s buried under a wall of text, use the one that you have access
   to. They all do pretty much the same thing packaged under a different brand.
 * Best regards,
   Anton

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

The topic ‘Offloading Specific Paths’ is closed to new replies.

 * ![](https://ps.w.org/cf-images/assets/icon-256x256.png?rev=2930278)
 * [Offload, AI & Optimize with Cloudflare Images](https://wordpress.org/plugins/cf-images/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cf-images/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cf-images/)
 * [Active Topics](https://wordpress.org/support/plugin/cf-images/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cf-images/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cf-images/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Anton Vanyukov](https://wordpress.org/support/users/vanyukov/)
 * Last activity: [1 year, 5 months ago](https://wordpress.org/support/topic/offloading-specific-paths/#post-18066296)
 * Status: not resolved