Gallery - image protocol [http/s]

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
ice70
New Member
New Member
Posts: 3
Joined: Thu Jun 25, 2020 10:26 am

Gallery - image protocol [http/s]

Post 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.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1791
Joined: Wed Feb 25, 2009 4:25 am

Re: Gallery - image protocol [http/s]

Post 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.
Not getting the answer you need? CMSMS support options
ice70
New Member
New Member
Posts: 3
Joined: Thu Jun 25, 2020 10:26 am

Re: Gallery - image protocol [http/s]

Post 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!
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1791
Joined: Wed Feb 25, 2009 4:25 am

Re: Gallery - image protocol [http/s]

Post 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.
Not getting the answer you need? CMSMS support options
Locked

Return to “Modules/Add-Ons”