I have a PHPR project (5.3) that is a digital asset management tool. I have a variety of different types of files stored there such as Audio,Video,Images,Documents etc. Right now, they are all presented as just a "file" so that the user can download them if desired. What I would like to do is create a preview/viewer system that updates the correct viewer type based on the type of asset in the system. I already have the structure for that kind of logic working as it associates the correct kind of "ICON" based on the asset type. My question is, how can I dynamically change the "View As" type based on the value of another field in that record so that the correct "viewer" is called. Here is what my current asset type logic does:
if ($data["Asset_Media_Type"] == 'Video'):
$value = '<img src="images/video-icon.png" alt="" />';
elseif ($data["Asset_Media_Type"] == 'Audio'):
$value = '<img src="images/audio-icon.png" alt="" />';
elseif ($data["Asset_Media_Type"] == 'Image'):
$value = '<img src="images/image-icon.png" alt="" />';
elseif ($data["Asset_Media_Type"] == 'Document'):
$value = '<img src="images/document-icon.png" alt="" />';
elseif ($data["Asset_Media_Type"] == 'Highlight'):
$value = '<img src="images/highlight-icon.png" alt="" />';
endif;
Is there a way to make this work?
Thanks
Dean