Search the FirstSpirit Knowledge Base
Hello,
Is it possible to get the Filetype value from the Media?
I tried with the following, but no success.
$CMS_VALUE(_download.Medium.getMedia.getType())$
Regards,
Dragan
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 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