Media (image) actions don't work

I’ve been tinkering with Grav for an evening or two. Nice. I’m pretty sick of Joomla and want something simpler. Grav looks like a good option so far.

I can’t get image resize or cropResize to work. Here are a couple of copy/pastes of my non-working commands:


The images just stay their normal 900,600 size. What am I missing?

Media functions only work on images that are associated with pages. Not just arbitrary images in an images/ directory under user. If you had them under user/pages/images then you could reach them and resize them with /images/mpr121_012sm.jpg?resize=300,200

Ideally you should put the images for a specific page, in the actual page folder. So if you are on page somwhere/else/page, then put the image in that same folder and just access/manipulate them with:

![](myimage.jpg?resize=300,200)

No paths needed!

Ah! Thank you.

I had been planning, as you say, on moving the page’s images into the page directory anyway. Guess I’ll get that done now.

Not working for example default page in path
/user/pages/01.home/sample-image.jpg
/user/pages/01.home/images/sample-image.jpg
/user/pages/images/sample-image.jpg
/user/images/sample-image.jpg
/images/sample-image.jpg

how folder path need for picture?
Example please

twig resize work

if delete cash folder resize not working. If add {{ dump(page.media[‘sample-image.jpg’]) }} again work.

As stated in the earlier post, the image needs to be associated with a page for it to be treated as page media and therefore, have the media functions work correctly.

So your first 3 examples could work, while the last 2 (not inside user/pages) will not work:

for /user/pages/01.home/sample-image.jpg, if you were in on the home page you could just use ![](sample-image.jpg?resize=300,200)

for /user/pages/01.home/images/sample-image.jpg if you were on the home page again, you would have to put a path: ![](/home/images/sample-image.jpg?resize=300,200)

For /user/pages/images/sample-image.jpg similar to above you need to reference the full path, but because it’s in user/page it will still work: ![](/images/sample-image.jpg?resize=300,200)

I think you have installed grav inside a directory or i don’t know, btw you can try to apply this commit and use the standard markdown text:

![](sample.jpg?resize=300,300)

and put sample.jpg in the same page folder.

The commit: https://github.com/getgrav/grav/pull/114