• Resolved packjallo

    (@packjallo)


    On previous builds we have been able to have complete control over the output of image URLs. With version 3 of the plugin, when we output an image that contains a Cloudinary URL, the Cloudinary plugin will automatically rewrite the URL. I’m sure this is desirable behaviour if you want a drop-in solution for image replacement, however, it would also be great if this could be disabled in some way to give those that want more flexibility the ability to use their own solution.

    The ability to control the output through a hook or function would be ideal, especially if we can disable source re-writing completely. Does something like this exist within the plugin currently? If not, is there anyway this can be done?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Anthony @ Cloudinary

    (@atdcloud)

    Hi Packjallo!

    Thanks for reaching out! Kindly share some code snippets of how you have implemented a “rewrite” on Cloudinary image URL output and the hooks that you have employed in doing so. This will give us further insights and may help you find a solution.

    Regards,
    Anthony

    Thread Starter packjallo

    (@packjallo)

    Hi Anthony,

    We’re getting the Cloudinary image URL using wp_get_attachment_metadata(), splitting the URL, and adding our own transforms in this way. This is a custom function that we use inside our theme.

    Doing this unfortunately means that our URL gets rewritten as part of the plugin. For now we have disabled this using the following, but I don’t know how sustainable it is to keep this in our functions file.

      function remove_cloudinary_actions() {
        remove_all_actions( 'cloudinary_string_replace' );
      };
      add_action('init', 'remove_cloudinary_actions', 999);

    Is there another option available to do this? Ideally more of a first-party solution?

    Many thanks,
    Jack.

    Plugin Support loic @ cloudinary

    (@loiccloudinary)

    Hi @packjallo,

    Would you mind opening a ticket to [email protected] and sharing a system report as explained [here](https://support.cloudinary.com/hc/en-us/articles/360022260599-How-to-generate-a-system-report-on-the-WordPress-plugin-)? If you can also add some assets (cf 2nd video) that would also be helpful.

    Thanks in advance.
    Best,
    Loic

    Just to piggyback off of this: we have the plugin option ‘Optimize images on my site.’ set to false (off) but the plugin still transforms my image URLs:

    For example, in my page I have an image:
    <img src="https://res.cloudinary.com/sallysapizza/images/v1669074237/dev/michael-discenza-MxfcoxycH_Y-unsplash/michael-discenza-MxfcoxycH_Y-unsplash.jpg?_i=AA">

    And this gets turned into:
    <img width="2054" height="2131" decoding="async" src="https://res.cloudinary.com/sallysapizza/images/w_2054,h_2131/v1669074237/dev/michael-discenza-MxfcoxycH_Y-unsplash/michael-discenza-MxfcoxycH_Y-unsplash.jpg?_i=AA" class="wp-image-99" data-public-id="dev/michael-discenza-MxfcoxycH_Y-unsplash.jpg" data-format="jpg" data-transformations="" data-version="1669074237">

    This is even worse with SVGs where it changes the file extension to png – completely negating the benefits of SVG.

    As with @packjallo we use custom functions to transform our image/video URLs to our liking, and this hijacking of the output is frustrating to have to hack around.

    I opened up a support ticket https://support.cloudinary.com/hc/requests/207924 and added a report, but was hoping you could shed some light on it in this thread so others may benefit.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Prevent the plugin from rewriting the theme source’ is closed to new replies.