Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter drbroad

    (@drbroad)

    It does not happen with local files, or jpgs that are offloaded.

    I will try another plugin – thanks

    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.

    Thread Starter drbroad

    (@drbroad)

    Yes, I understand what is happening. I don’t understand why it isn’t being type checked before attempting to access it.

    You should know that dumping out those three arguments is going to cause the browser to crash due to the sheer amount of data being output.
    You only want to see the data if it is malformed so I added this into the code:

    
    if ( '' === $key ) {
    			$new[] = $value;
    		} else {
    			if(!is_array($new)){
    				echo "--------------- <br>";
    				echo "Parts: <br>";
    				var_dump ($parts);
    
    				echo "<br><br>Param: <br>";
    				var_dump ($param);
    
    				echo "<br><br>Value: <br>";
    				var_dump ($value);
    				die();
    			}
    			
    			$new[ $key ] = $value;
    		}
    
    

    And the output is:

    
    ---------------
    Parts:
    array(0) { }
    
    Param:
    string(0) ""
    
    Value:
    string(0) ""

    `

    So why not just add something like this on like 55:
    if(!is_array($new)) return $new;

    Given that this is an issue with your plugin argument handling, I’m curious why you are asking me to debug your code rather than your developers?

    • This reply was modified 2 years, 4 months ago by drbroad.
    • This reply was modified 2 years, 4 months ago by drbroad.
Viewing 3 replies - 1 through 3 (of 3 total)