Filetype value from the Media
Author: draganr
Publication Date: 6/22/2018 8:31
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
-
Author: felix_reinhold - 6/22/2018 12:09
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
0 -
Author: draganr - 6/22/2018 13:06
Hello Felix,
Thank you very much. It solved my problem.
Best regards,
Dragan0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
2 commentaires