Title: Replace some images
Last modified: July 17, 2023

---

# Replace some images

 *  Resolved [jeiriart](https://wordpress.org/support/users/jeiriart/)
 * (@jeiriart)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/)
 * Hi, I need exclude some images (by ID for example) from CDN. What filters do 
   you use to change the original image to the CDN image? I thought they use wp_get_attachment_url
   or wp_calculate_image_srcset but they don’t work.
    -  This topic was modified 2 years, 10 months ago by [jeiriart](https://wordpress.org/support/users/jeiriart/).

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

 *  Plugin Author [RabbitLoader](https://wordpress.org/support/users/sanrl/)
 * (@sanrl)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/#post-16902255)
 * Dear [@jeiriart](https://wordpress.org/support/users/jeiriart/)
 * All the CPU-intensive optimizations are performed by RabbitLoader cloud servers,
   thus reducing the usage of your hosting resources. Due to this, some WP filters
   may not work.
 * There are many ways by which you can exclude images from getting optimized by
   RabbitLoader, and the easiest one is by adding a data attribute `data-rlskip="
   1"` to any IMG tag.
 *  Other ways are explained in this KB -https://rabbitloader.com/kb/exclude-images-
   from-lazy-loading/
 *  Thread Starter [jeiriart](https://wordpress.org/support/users/jeiriart/)
 * (@jeiriart)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/#post-16903442)
 * Hi, yes, that works, but the images are backgrounds, we need to be able to intervene
   the hook that loads them, in this case “wp_calculate_image_srcset” does not work
   because it is for images with “figure” or “img” tags and we discard it since 
   for backgrounds this hook does not work. In the administration panel works “wp_get_attachment_url”
   but not in the frontoffice. How do you replace the image then if not with hooks?
 * Thanks
    -  This reply was modified 2 years, 10 months ago by [jeiriart](https://wordpress.org/support/users/jeiriart/).
 *  Plugin Author [RabbitLoader](https://wordpress.org/support/users/sanrl/)
 * (@sanrl)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/#post-16904995)
 * Dear [@jeiriart](https://wordpress.org/support/users/jeiriart/) Please provide
   us the webpage URL and Image URL that you wish to exclude from CDN. I will analyze
   and suggest the most suitable approach.
 *  Thread Starter [jeiriart](https://wordpress.org/support/users/jeiriart/)
 * (@jeiriart)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/#post-16905951)
 * My problem is that your cdn shrinks the size of the image to 1920px wide, this
   makes the design break on some screens, so we want to be able to remove those
   particular images from the cdn. Problem 1: they are changing all the time and
   there are always new ones, we need to be able to do it ourselves. Problem 2: 
   we need to be able to do it from the WordPress backoffice.
   Web: [https://arcorencasa.com/bagley/](https://arcorencasa.com/bagley/)
   Image: [https://cfw.rabbitloader.xyz/eyJjIjp0cnVlLCJoIjoiYXJjb3JlbmNhc2EuY29tIiwidiI6MjcwMzc0NjM2Mn0/wp-content/uploads/2023/07/seccion-fondo-bagley-rojo2.png](https://cfw.rabbitloader.xyz/eyJjIjp0cnVlLCJoIjoiYXJjb3JlbmNhc2EuY29tIiwidiI6MjcwMzc0NjM2Mn0/wp-content/uploads/2023/07/seccion-fondo-bagley-rojo2.png)(
   is a background)
 *  Plugin Author [RabbitLoader](https://wordpress.org/support/users/sanrl/)
 * (@sanrl)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/#post-16908279)
 * Dear [@jeiriart](https://wordpress.org/support/users/jeiriart/) thank you for
   the details. It gave me a fair picture of what is happening.
 * If we allow adding a GET parameter to the image URL, for example, `img.png?rl-
   resize=0 `to prevent resizing particular images, will that solve your purpose?
   If it does, the next thing would be to intercept the inline CSS injected inside`
   porto-style-inline-css` that holds this backgorund-image. Do you know if the 
   source of this inline CSS has any hooks to append this new GET parameter to the
   end of the image URL?
 *  Thread Starter [jeiriart](https://wordpress.org/support/users/jeiriart/)
 * (@jeiriart)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/#post-16908801)
 * Hi, no, this is built with WPBakery, so there are no hooks to intercept the css.
   We need to be able to intercept the image directly, but I understand it is not
   possible to do this?
 *  Plugin Author [RabbitLoader](https://wordpress.org/support/users/sanrl/)
 * (@sanrl)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/#post-16909842)
 * Did you try checking with the WPBakery team if there is a way to append parameters
   to the Image URL?
 * RabbitLoader can help you with these options, I have summarized all options here
   to keep track of them-
    - by setting its class name in the Page Rule. (not applicable here because it’s
      a background image)
    - by setting the image file name in Page Rule. (feature does not exist now but
      is feasible)
    - by setting a GET parameter in the image URL (aka `img.png?rl-resize=0`) through
      PHP code. (Depends if it’s possible to do via WPBakery)
    - by using an image that comes from a different host than the website (for example
      S3, or other image hosting service). [RabbitLoader does not touch images from other origins than the actual website](https://rabbitloader.com/kb/enable-image-auto-conversion-to-webp/).
 * We are open to suggestions if you can think of other possibilities.
 *  Thread Starter [jeiriart](https://wordpress.org/support/users/jeiriart/)
 * (@jeiriart)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/#post-16910072)
 * Hi, the theme is Portos, and this: ?rl-resize=0 was the solution
   thanks!
 *  Plugin Author [RabbitLoader](https://wordpress.org/support/users/sanrl/)
 * (@sanrl)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/#post-16914785)
 * perfect 😀 I am glad that it helped.

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

The topic ‘Replace some images’ is closed to new replies.

 * ![](https://ps.w.org/rabbit-loader/assets/icon.svg?rev=2984534)
 * [RabbitLoader – AI Speed Optimization, Caching & CDN for WordPress & WooCommerce](https://wordpress.org/plugins/rabbit-loader/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rabbit-loader/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rabbit-loader/)
 * [Active Topics](https://wordpress.org/support/plugin/rabbit-loader/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rabbit-loader/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rabbit-loader/reviews/)

## Tags

 * [cdn](https://wordpress.org/support/topic-tag/cdn/)
 * [exclude](https://wordpress.org/support/topic-tag/exclude/)
 * [images](https://wordpress.org/support/topic-tag/images/)

 * 10 replies
 * 2 participants
 * Last reply from: [RabbitLoader](https://wordpress.org/support/users/sanrl/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/replace-some-images/#post-16914785)
 * Status: resolved