4 edited tags
| link
3 corrected mistakes
source | link

I am making a flex slider module, and it needs to just load some images statically, the only way I was able to get hold of any of the images was when I used a relative path in a background-image: url(relative-path-to-image) in a css file, but I am not interested in loading it through css. 

If I try to access it relative from the template, using <img src="relative-path-to-image"> it won't work of course, because the src tag are being loaded on the client. I have looked a bit at the templating system and I can use a {{ directory }} variable inside of twig, to maybe get the absolute path to the images right, but i. But I just feel like even if iI made that work it would still be a disaster implementation.

So my question is, if you need to add a tag and give it a src path-to-image, what is your go-to solution to get that image accessible.

I have been looking at this for way too long :) ?

I am making a flex slider module, and it needs to just load some images statically, the only way I was able to get hold of any of the images was when I used a relative path in a background-image: url(relative-path-to-image) in a css file, but I am not interested in loading it through css. If I try to access it relative from the template, using <img src="relative-path-to-image"> it won't work of course, because the src tag are being loaded on the client. I have looked a bit at the templating system and I can use a {{ directory }} variable inside of twig, to maybe get the absolute path to the images right, but i just feel like even if i made that work it would still be a disaster implementation.

So my question is, if you need to add a tag and give it a src path-to-image, what is your go-to solution to get that image accessible.

I have been looking at this for way too long :)

I am making a flex slider module, and it needs to just load some images statically, the only way I was able to get hold of any of the images was when I used a relative path in a background-image: url(relative-path-to-image) in a css file, but I am not interested in loading it through css. 

If I try to access it relative from the template, using <img src="relative-path-to-image"> it won't work of course, because the src tag are being loaded on the client. I have looked a bit at the templating system and I can use a {{ directory }} variable inside of twig, to maybe get the absolute path to the images right. But I just feel like even if I made that work it would still be a disaster implementation.

So my question is, if you need to add a tag and give it a src path-to-image, what is your go-to solution to get that image accessible?

2 corrected mistakes
source | link

Useing Using images in custom module  (not through css)

Im makeingI am making a flex slider module, and it needs to just load some images statically, the only way iI was able to get hold of any of the images was when iI used a relative path in a background-image: url(relative-path-to-image) in a css file, but imI am not interested in loading it through css. If iI try to access it relative from the template, useing it wontusing <img src="relative-path-to-image"> it won't work of course, because the srcsrc tag are being loaded on the client. IveI have looked abita bit at the templateingtemplating system and iI can use a {{ directory }} variable inside of twig, to maybe get the absolute path to the images right, but i just feel like even if i made that work it would still be a disaster implementation.

So my question is, if you need to add a tag and give it a src path-to-image, what is your go-to solution to get that image accessible.

IveI have been looking at this for waaayway too long :)

Useing images in custom module(not through css)

Im makeing a flex slider module, and it needs to just load some images statically, the only way i was able to get hold of any of the images was when i used a relative path in a background-image: url(relative-path-to-image) in a css file, but im not interested in loading it through css. If i try to access it relative from the template, useing it wont work of course, because the src tag are being loaded on the client. Ive looked abit at the templateing system and i can use a {{ directory }} variable inside of twig, to maybe get the absolute path to the images right, but i just feel like even if i made that work it would still be a disaster implementation.

So my question is, if you need to add a tag and give it a src path-to-image, what is your go-to solution to get that image accessible.

Ive been looking at this for waaay too long :)

Using images in custom module  (not through css)

I am making a flex slider module, and it needs to just load some images statically, the only way I was able to get hold of any of the images was when I used a relative path in a background-image: url(relative-path-to-image) in a css file, but I am not interested in loading it through css. If I try to access it relative from the template, using <img src="relative-path-to-image"> it won't work of course, because the src tag are being loaded on the client. I have looked a bit at the templating system and I can use a {{ directory }} variable inside of twig, to maybe get the absolute path to the images right, but i just feel like even if i made that work it would still be a disaster implementation.

So my question is, if you need to add a tag and give it a src path-to-image, what is your go-to solution to get that image accessible.

I have been looking at this for way too long :)

1
source | link