Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

New mediapicker field from v1.5.0-rc.3

Solved by Andy Miller View solution

Started by Dimitri Longo 9 years ago · 4 replies · 1294 views
9 years ago

Hi

Can i have some explanation about New mediapicker field changelog v1.5.0-rc.3
before i use filepicker

how can i retrieve mime or filename with the new mediapicker ?

Thanks

9 years ago Solution

Going to note down the fact that we need to document it. In the meantime, here's an example of how it's used:

YAML
header.image:
  type: mediapicker
  folder: 'self@'
  label: Select a file
  preview_images: true
  accept:
    - .jpg

It stores the path to the file, even if it's in another page. Then to use:

TWIG
{% set image_parts = pathinfo(spread.image) %}
{% set image_basename = image_parts.basename %}
{% set image_page = image_parts.dirname == '.' ? page : page.find(image_parts.dirname) %}

{{ image_page.media[image_basename].html() }}
👍 2
9 years ago

thanks, that's it
new mediapicker field is really great

9 years ago

I'm late to the topic, but... AWESOME!

I tried GRAV out for the first time a couple of months ago. GRAV already performed really well in comparison to most other CMS even back then, but it lacking a good media manager was a big problem for me. With this new field type, GRAV shot to the top of my list.

If the ability to 'localize' form fields gets added at some point, GRAV will beat 95% of all other systems out there, no contest.

9 years ago

@rhuk you added preview_images to your blueprint, will this be supported?

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1135 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 60 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 132 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 108 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 127 7 months ago