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.

Archive

Image width,height from a file upload via filepicker field choose by file field

Started by Muut Archive 10 years ago · 0 replies · 415 views
10 years ago

I try to get image width & height from a file upload via filepicker field choose byfile field, before using these fields , I use pagemediaselect and get width & height :

TWIG
{% set image_width  = page.media[el_background_image].width %}
{% set image_height = page.media[el_background_image].height %}

and now the array is like that with filepicker and file ,

JS
array:1 [
  "user/themes/mytheme/images/pattern.jpg" => array:4 [
    "name" => "pattern.jpg"
    "type" => "image/jpeg"
    "size" => 3182
    "path" => "user/themes/mytheme/images/pattern.jpg"
  ]
]

So it seems we can't have image width and height. Maybe a workaround is possible

Thanks for tips.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1280 9 years ago
Archive · by Muut Archive, 9 years ago
2 888 9 years ago
Archive · by Muut Archive, 9 years ago
2 4017 9 years ago
Archive · by Muut Archive, 9 years ago
1 2892 9 years ago
Archive · by Muut Archive, 9 years ago
3 1077 9 years ago