draganr
I'm new here

Filetype value from the Media

Jump to solution

Hello,

Is it possible to get the Filetype value from the Media?

filetype.PNG


I tried with the following, but no success.

$CMS_VALUE(_download.Medium.getMedia.getType())$


Regards,
Dragan

1 Solution

Accepted Solutions
felix_reinhold
Returning Responder

Hello Dragan,

you have to check wether the element is a file or picture and then use the corresponding getExtension-function :

$CMS_SET(set_Media, _download.Medium.getMedia())$

$CMS_IF(set_Media.type==0)$

    $-- File --$

    $CMS_VALUE(set_Media.getFile(null).getExtension())$

$CMS_ELSE$

    $-- Picture --$

    $CMS_VALUE(set_Media.getPicture(null).getPictureMetaData(#global.project.originalResolution).getExtension())$

$CMS_END_IF$

Fo rlanguage-dependant media provide the language at the getFile/getPicture method.

Best regards

Felix

View solution in original post

2 Replies
felix_reinhold
Returning Responder

Hello Dragan,

you have to check wether the element is a file or picture and then use the corresponding getExtension-function :

$CMS_SET(set_Media, _download.Medium.getMedia())$

$CMS_IF(set_Media.type==0)$

    $-- File --$

    $CMS_VALUE(set_Media.getFile(null).getExtension())$

$CMS_ELSE$

    $-- Picture --$

    $CMS_VALUE(set_Media.getPicture(null).getPictureMetaData(#global.project.originalResolution).getExtension())$

$CMS_END_IF$

Fo rlanguage-dependant media provide the language at the getFile/getPicture method.

Best regards

Felix

Hello Felix,

Thank you very much. It solved my problem.

Best regards,
Dragan

0 Kudos