1

I have an assets field type in a matrix cell. To place this on my page I am using

<img src="{cell_1}">

which gives the full url

<img src="http://www.mysite.com/images/image.jpeg">

That is great but is going to ping up as an insecure element on https pages. How would I get this on my page with a relative path to avoid that issue? I know I can use filename but hardcoding the path in the template isnt really an option.

2 Answers 2

2

Have you tried this:

{assets_cell}
<img src="/images/{filename}" />
{/assets_cell}

That'll need to be in the channel entries tag, in your Matrix tag. The full list of variables is under "Primary Tag Pair" in our Assets docs. So you can build your paths "a la carte" if needed. :)

1
  • Also check your Upload Filedirs URL settings - if you have used absolute URL there and it is starting with http://, then you probably shouldn't be all that surprised :) Feb 23, 2013 at 15:09
0

not sure I know what you mean. Are you suggesting adding a new field in my matrix and writing that code in it?

oh I get it now. The problem is that I am not always going to know the path so wouldn't want to hard code it in the template.

Sorry scratch that, I didn't see the comment posted by Andris tucked away there :(

That was totally the problem, cheers Andris.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.