syamilmj / Aqua-Resizer

Resize WordPress images on the fly
502 stars 208 forks source link

Images not working on SSL with https #21

Open ghostpool opened 11 years ago

ghostpool commented 11 years ago

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?

wpexplorer commented 11 years ago

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

ramzesimus commented 11 years ago

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

ghostpool commented 11 years ago

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.

syamilmj commented 11 years ago

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

Cheers

ghostpool commented 10 years ago

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

highergroundstudio commented 10 years ago

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 commented 10 years ago

Any updates on this?

wizard247 commented 10 years ago

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 commented 10 years ago

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

wpexplorer commented 10 years ago

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

mxmzb commented 10 years ago

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.

wpexplorer commented 10 years ago

@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.

mxmzb commented 10 years ago

@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 :)

miqronaut commented 10 years ago

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;
}
wpexplorer commented 10 years ago

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

jesush commented 9 years ago

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/ ).

bre7 commented 8 years ago

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

SantoshTupsy commented 7 years ago

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
Madison39 commented 4 years ago

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!