## UWeb
Class ImageServer

source: C:\XIII\UWeb\Classes\ImageServer.uc

    Core.Object
       |
       +--UWeb.WebApplication
          |
          +--UWeb.ImageServer

Direct Known Subclasses:None

class ImageServer
extends UWeb.WebApplication

Source Code

    00001	class ImageServer extends WebApplication;
    00002
    00003	/* Usage:
    00004	[UWeb.WebServer]
    00005	Applications[0]="UWeb.ImageServer"
    00006	ApplicationPaths[0]="/images"
    00007	bEnabled=True
    00008
    00009	http://server.ip.address/images/test.jpg
    00010	*/
    00011
    00012	event Query(WebRequest Request, WebResponse Response)
    00013	{
    00014		local string Image;
    00015
    00016		Image = Mid(Request.URI, 1);
    00017		if( Right(Caps(Image), 4) == ".JPG" || Right(Caps(Image), 5) == ".JPEG" )
    00018			Response.SendStandardHeaders("image/jpeg");
    00019		else
    00020		if( Right(Caps(Image), 4) == ".GIF" )
    00021			Response.SendStandardHeaders("image/gif");
    00022		else
    00023		if( Right(Caps(Image), 4) == ".BMP" )
    00024			Response.SendStandardHeaders("image/bmp");
    00025		else
    00026		{
    00027			Response.HTTPError(404);
    00028			return;
    00029		}
    00030		Response.IncludeBinaryFile( "images/"$Image );
    00031	}
    00032	defaultproperties
    00033	{
    00034	}

End Source Code