Aqua-Resizer icon indicating copy to clipboard operation
Aqua-Resizer copied to clipboard

Images not working on SSL with https

Open ghostpool opened this issue 11 years ago • 19 comments

Hi there,

Excellent script.

I've had a number of my customers tell me that their images do not display when they use SSL and switch to https in the URL. I'm surprised to see nobody else appears to have brought this up, is there any fix for this, or is it a script issue at all?

ghostpool avatar Apr 16 '13 07:04 ghostpool

I'm actually trying to figure this out at the moment as well

wpexplorer avatar Apr 30 '13 07:04 wpexplorer

I have the same issue on https. Any ideas on this issue would be much appreciated.

ramzesimus avatar May 08 '13 07:05 ramzesimus

I'm glad to see I'm not the only one with the issue. I believe it is something to do with the wp_upload_dir not supporting https, but I'm not sure yet, hopefully this is something the developers of the script can look into.

ghostpool avatar May 08 '13 07:05 ghostpool

If anyone would like to offer a test install with https, I'd be happy to fix this.

Cheers

syamilmj avatar May 11 '13 09:05 syamilmj

I have emailed you WordPress login and FTP details to a https server so you can look into this issue. :)

ghostpool avatar Aug 09 '13 09:08 ghostpool

I just had the same problem reported to me on my plugin. I never tested in https and didn't think about doing it for some reason. https://github.com/highergroundstudio/myContest/issues/62#issuecomment-24134138

highergroundstudio avatar Sep 10 '13 15:09 highergroundstudio

Any updates on this?

highergroundstudio avatar Sep 11 '13 18:09 highergroundstudio

I have this issue too - pulling my web site page into Facebook (car sales dealership) but the car images are not showing through https.

Any chance of this being solved in a future issue or is there a way around it?

Thanks all!

wizard247 avatar Nov 09 '13 00:11 wizard247

Will send you FTP details if you can fix this as you mentioned. :)

wizard247 avatar Nov 09 '13 00:11 wizard247

I'm interested to learn of this issue can be resolved. Thanks!

wpexplorer avatar Nov 09 '13 23:11 wpexplorer

If someone grants me access to some suitable setup regarding this issue + I get paid, let's say 300 bucks, I am going to do that for you. Don't get me wrong at the payment point, I'm not greedy, but I am pretty much busy with other things and also suspect, that some of you might be interested in this feature by commercial aspects, so I think it's fair to ask for a piece of the pie.

mxmzb avatar Nov 09 '13 23:11 mxmzb

@maximski - price point makes sense to me, but I currently don't have an active site with the issue. I just remember it being a problem in the past and curious to see what the best fix is.

wpexplorer avatar Nov 10 '13 00:11 wpexplorer

@wpexplorer It's just an offer, not more and not less. I have personally have no need for this feature currently, too, so I'm probably not the one implementing this without appropriate motivation. Just saying :)

mxmzb avatar Nov 10 '13 00:11 mxmzb

Most browsers are permitted by default to display http images on https pages, but to accommodate the exceptions, if you are using wp_get_attachment_url() with this script, try adding a filter so image URLs do not always begin with http. http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_get_attachment_url $_SERVER['HTTPS'] == 'on' in that code did not work on a couple of my servers, but the tweaks below fixed it. Load-balanced servers may need $_SERVER['HTTP_USESSL'] instead.

add_filter('wp_get_attachment_url', 'honor_ssl_for_attachments');
function honor_ssl_for_attachments($url) {
    $http = site_url(FALSE, 'http');
    $https = site_url(FALSE, 'https');
    $isSecure = false;
    if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'
    || $_SERVER['SERVER_PORT'] == 443) {
        $isSecure = true;
    }
    return ( $isSecure ) ? str_replace($http, $https, $url) : $url;
}

miqronaut avatar May 20 '14 17:05 miqronaut

@miqronaut - awesome dude, thanks for the heads up!

wpexplorer avatar May 20 '14 17:05 wpexplorer

Possible solution, why not simply leave out the http protocol out of the image via a filter, it's safe ( http://www.ietf.org/rfc/rfc3986.txt ), Relative URLs ( http://www.paulirish.com/2010/the-protocol-relative-url/ ).

jesush avatar Aug 22 '14 04:08 jesush

Bump... @jesush solution seems to be the best... PR sent 😉

bre7 avatar Jun 18 '16 23:06 bre7

x htaccess

  1. Login to your Cpanel
  2. goto "Public_html"
  3. Show hidden files under "Settings"
  4. Right click and edit ".htaccess"
  5. Add "#" at the start to each and every line of code.
  6. Save

SantoshTupsy avatar Nov 17 '16 08:11 SantoshTupsy

Thank you SantoshTupsy! This is THE BEST and most simple solution! I have installed different SSL on domain and subdomain and had this images not showing problem in sub-domain. I have spent HOURS to find a way to fix this issue and nothing helped: I tried Really Simple SSL..nothing; changed link url in General..nothing; tried scripts, plugins to force, checked folders permissions, redirects and so on for loooong hours! After i have followed your .htaccess instructions everything came back fast with a simple refresh of the page! You have no idea how thankful i am to you!

Madison39 avatar Sep 10 '19 13:09 Madison39