/** * Image * @param id * @param textureLink * @param filename * @param size * @param contentType * @constructor */ GameLib.D3.Image = function( id, textureLink, filename, size, contentType ) { this.id = id; this.filename = filename; this.textureLink = textureLink; if (typeof size == 'undefined') { size = 0; } this.size = size; if (typeof contentType == 'undefined') { contentType = 'application/octet-stream'; if (this.filename.match(/(png)$/i)) { contentType = 'image/png'; } if (this.filename.match(/(jpg|jpeg)$/i)) { contentType = 'image/jpeg'; } if (this.filename.match(/(gif)$/i)) { contentType = 'image/gif'; } } this.contentType = contentType; };