Page 1 of 1

Gallery - image protocol [http/s]

Posted: Tue Aug 04, 2020 2:24 pm
by ice70
Hi,

I have installed the gallery module http://dev.cmsmadesimple.org/projects/gallery

In the smarty tag {$image->file} I am getting the full image path, including protocol and domain. Which works fine in http but in https triggers insecure content warnings.
How can I remove at least the protocol, or just change to root relative paths?

eg:
from: http://domain.com/path/to/img/img.jpg
to: //domain.com/path/to/img/img.jpg
or, ideally: /path/to/img/img.jpg

thank you for any help.

Re: Gallery - image protocol [http/s]

Posted: Tue Aug 04, 2020 3:09 pm
by DIGI3
It should get the https url when viewed on https - it's getting it from root_url as far as I can tell. I just did a quick test on the latest version and {$image->file} outputs https://etc when viewed on https, and http://etc when viewed on http.

If you really want to strip it though, you could perhaps do something like
{$image->file|replace:"{root_url}":""}
Which may not work if it's a configuration issue causing your problem.

You may wish to check config.php and htaccess for anything forcing the image url back to http - and of course make sure you're not viewing a cached page.

Re: Gallery - image protocol [http/s]

Posted: Wed Aug 05, 2020 6:17 am
by ice70
Hi Digi3,

thank you for your reply.

tried using
{$image->file|replace:"{root_url}":""}
but that only worked when viewing on the http version of the site...

So updated confog.php - $config['root_url'] to use the https protocol and updated htaccess to force https and everything is now on the https protocol.
thank you for your help!

Re: Gallery - image protocol [http/s]

Posted: Wed Aug 05, 2020 1:27 pm
by DIGI3
In newer versions of CMSMS you can actually remove all of the url and path settings in config, they're calculated automatically - that would probably have done the trick too. Glad you figured it out though.