Is there a way for me to write an if-statement that checks the type of whatever file is pulled?
I’d like to pull all files from a page and apply different markup to images and videos. Here’s my current code, which pulls all the files but only contains markup-application suited to images:
I’d like to add an if-statement within the foreach-loop to make a distinction between images and videos. I can probably use $file->type() to do so? How would the full statement have to look like? Something like this?:
You can filter on the extension though, useful if you wanted to add filetype icons, or something to a download list… i did it this way in one of my projects, but maybe theres a slicker way… works though.