Argon

A beautiful theme based on CreativeTim Argon. Comes with a simple page builder and custom blocks that extends Argon Design System.

Back to Argon Support

laszlo.zenware.io
laszlo.zenware.io

Hi Gerald! I mentioned this in my review of your theme:

all of the images referenced in the example pages included in the theme have URL's set like this: /storage/app/media/demo/theme/promo-1.png. This is incorrect, the theme's pictures are stored in /themes/matethemes-argon/assets/images/theme/promo-1.png.

You replied:

I don't have any idea how to add the images in the media manager on installation. So the fields are blank. Do you have any suggestions to solve this?"

I can't seem to be able to reply to your question on my review for the argon theme, so I'm writing you here. So the problem is that in your static pages that you ship with your theme you have for example:

sections[2][section_tmtextimage_image] = '/demo/theme/promo-1.png'

Which ends up being translated to: /storage/app/media/demo/theme/promo-1.png

But you want to have it point to: /themes/matethemes-argon/assets/images/theme/promo-1.png

One work-around would be to change the address in your static page to:

sections[2][section_tmtextimage_image] = '/../../../themes/matethemes-argon/assets/images/theme/promo-1.png'

I tried it and this works as long as in your partial blocks you always "hard-code" the image address (like you do in tmlinkcards.htm): /storage/app/media{{ fields.section_tmlinkcards_logoimage }}

It does NOT work if you use the |media filter (which is imho a better approach), because then October will give you an "Invalid file path specified: '/../../../themes/matethemes-argon/assets/images/theme/promo-1.png'." error.

A better approach would be as follows. (1) Replace all your URL-s in your static pages to start with three slashes and to point to the proper directory under your theme, in our example it would be:

sections[2][section_tmtextimage_image] = '///assets/images/theme/promo-1.png'

(2) Then, in your partial blocks add some logic: depending on whether the image starts with "///", show the file using the |theme or the |media twig filter. So, as follows (in this case in tmtextimage.htm):

<img data-src="{{ data.section_tmtextimage_image starts with '///' ? data.section_tmtextimage_image|theme : data.section_tmtextimage_image|media }}" class="img-fluid floating">

The three forward slashed won't affect the URL since they will be treated as if they were just one. I tried this as well and it works perfectly.

1-1 of 1