I am trying to find some way where I can control what content are shown based on uploaded files. For example:
If the uploaded file is a .jpg or .png image, somewhere in the body of the article will display the thumbnail of the uploaded image.

It is kinda like to display file icon based on file extension of file value field. But I don't know how to do it. Can anyone offer a snippet?

Thanks a lot!

Comments

usabilitydeveloper.com’s picture

Title: how to display content based on uploaded files extention » i have already figured it out

i figured it out

if ($node->taxonomy[9])
{
   
foreach ($node->files as $fid => $file)
{
$file->filemime = $node->files[$fid]->filemime;
     if(strpos($file->filemime, 'audio/') === 0)
     {
     print '......';
      }
}
}
silverwing’s picture

Title: i have already figured it out » how to display content based on uploaded files extention
Status: Active » Fixed

changing the title back so others can see what the issue was about and marking your issue as fixed as you seem to have figured it out.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.