PHP and javascript snippets you can copy and paste.

Thursday, April 12, 2007

js_is_image(ext)

/**
* Returns true if ext is an image extension.
*
* @param string ext.
* return bool
*/
function js_is_image(ext){

var imgExtsArr = new Array();
imgExtsArr.png = true;
imgExtsArr.jpg = true;
imgExtsArr.gif = true;
imgExtsArr.jpeg = true;

return imgExtsArr[ext];

}

1 comment:

admin said...

Tested 14 April 2007.