WordPress.org

Support

Support » Plugins and Hacks » Will it remove SSL request?

Will it remove SSL request?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Scott Werner
    Member

    @scottwerner

    When you insert an image, the url should appear as this:
    src=”/wp-content/uploads/2013/04/thumbs-up-1.jpg”

    I’m not 100% sure on your question. Do you want it to remove the //domain.com part?

    I have the exact same problem… as he said, the initial URL submitted by the media browser starts with https:// because we’re using SSL to protect the administrative area (everything in /wp-admin/).

    So you need to strip https:// in addition to http://

    Replace str_replace("http://","",$imageurl); with preg_replace("/^https?:\/\//","",$imageurl);

    In fact this is my use case for this plugin. I don’t want to hardcode https:// in URL because I want visitors to load the pictures with the same protocol that they used to load the page that they are visiting. My SSL certificate is self-signed and browsers won’t load pictures from self-signed https servers when they are visiting a non-https page.

    Just to be clear, obviously the part “//domain.com” is completely wrong in the URL that he gets. It’s the hostname of the original URL and it shouldn’t end up in the relative URL.

    Also the plugin doesn’t work when the URL of the link is different from the URL of the displayed image (quite a common case):

    I get this for instance:
    <a href="https://badminton-sorbiers.fr/files/2013/07/photo-bad.jpg"><img src="/files/2013/07/photo-bad-174x300.jpg" alt="photo bad" width="174" height="300" class="aligncenter size-medium wp-image-1064" /></a>

    instead of the expected

    <a href="/files/2013/07/photo-bad.jpg"><img src="/files/2013/07/photo-bad-174x300.jpg" alt="photo bad" width="174" height="300" class="aligncenter size-medium wp-image-1064" /></a>

    So maybe you need to also take care of the replacing what you find in the href attribute…

    Enterpr1se
    Participant

    @enterpr1se

    Hi,

    The output is

    <a href="https://www.enterpr1se.info/wp-content/uploads/2013/05/Yahoo_HK_Enterpr1se.png"><img class="aligncenter size-medium wp-image-12255" alt="Yahoo_HK_Enterpr1se" src="//www.enterpr1se.info/wp-content/uploads/2013/05/Yahoo_HK_Enterpr1se-640x305.png" width="640" height="305" /></a>

    I expect the result should be

    <a href="/wp-content/uploads/2013/05/Yahoo_HK_Enterpr1se.png"><img class="aligncenter size-medium wp-image-12255" alt="Yahoo_HK_Enterpr1se" src="/wp-content/uploads/2013/05/Yahoo_HK_Enterpr1se-640x305.png" width="640" height="305" /></a>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Will it remove SSL request?’ is closed to new replies.