Getting image from a global dir

I have tried everything I can and I can’t get an image to load with the twig image manipulation tag from a global directory. I basically want this to work on any page:

{{['/images/page-bg.jpg'].cropZoom(1000,150).quality(95).url() }}

I created a folder in user/pages called ‘images’ and put my image in there but it won’t load. I also created a folder user/images and tried to load it from there but no cigar:

{{['/user/images/page-bg.jpg'].cropZoom(1000,150).quality(95).url() }}

Any ideas?

Ok, I know the problem. The way you are trying to load the image is via which is basically just an array of the media for the current page. To do what your trying to do you would need first get the images page, and then manipulate its media. So something like:

{{ page.find('/images').media['page-bg.jpg').cropZoom(1000,150).quality(95).url() }}

Now, the markdown syntax has some advanced capabilities as outlined in the learn docs. So you could do it with markdown in the page like this:


But this is going to output the image, tag and all.

Thanks! That worked (except for your typo)

 ] not )


Yup good catch on that typo :slight_smile: