I'm getting the cloudinary image/video ID like this:
<?php echo cloudinary_url($_upload->getPublicId()); ?>
which gives a URL like: http://res.cloudinary.com/dviiu412p/image/upload/v1/campaigns/1/jfle7ilxkyfmj9mjggwa
And then rendering it out as an image or video like so:
<img class="lazy-load"
src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
data-src="<?php echo cloudinary_url($_upload->getPublicId()); ?>" />
<video class="lazy-load" controls>
<source data-src="<?php echo cloudinary_url($_upload->getPublicId(), array("resource_type"=>video, "height"=>230, "width"=>340, "format"=>webm)); ?>" type="video/webm">
</video>
The problem is I only want to serve either an image or video (whichever one was uploaded by the user). Is there a way I can achieve this? I was thinking instanceof might be able to do this but I've never used it before. Any help would be much appreciated