Hi guys I have the following code which checks for the extension type and display accordingly.
The first section checks to see if it is an image.
The second if it is a video.
The third show id none of the above.
It is failing on ext = JPG ( ie it shows as a link ).
What am I doing wrong here please?
render: function(data, type, row)
{
if (data !== undefined ){
var ext = data.substr(data.lastIndexOf('.') + 1);
if ( (ext === 'jpeg' ) || ( ext === 'jpg' ) || ( ext === 'JPG' ) || ( ext === 'jp2' ) || ( ext === 'png' )|| ( ext === 'gif' ) || ( ext === 'pdf' ))
{
return '<img src=" ' + data + ' "' + imageSize + ' class="info1">';
}
// now check if it is a video
if ( (ext === 'mp4')|| ( ext === 'MOV' ))
{
return ' <video width="320" height="240" controls> <source src=" ' +data + ' " type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support the video tag. </video>'
}
// last here so must be download
{
var fullPath = data.split('.')[0];
var filename = fullPath.replace(/^.*[\\\/]/, '');
return ' Click to Download <br/> <a href=" '+ data + ' " target="_blank" > '+ data + " </a> ";
}
} else { return '' };
}
}