Is it somehow possible to have a static webpage with some images stored in Resources? I mean the web page can be treated just as string and sent to client, but i have been unable so far to send image file. I can get the image from resources
Bitmap image = Resources.GetBitmap(
Resources.BitmapResources.Image1
);
But what to do then? how to read bytes from these image and send them to client? Or is there some other way? I don’t want to use SD card or anything external, that would be a waste of resources.
Well, if you add an image to the embedded resources (Resources.resx) Visual Studio will use it as a bitmap (see the example above). In older Micro .NET Framework it isn’t really easy to get the bytes from an image.
The best way to return images do following:
- Rename your image xxxx.jpg to xxxx.bin
- Open Resources.resx and select the type files (instead of type images)
- Click on add new file, select file filter *.*
- Select the image xxxx.bin which will be added as xxxx embedded resource
Then you can use following code in your HttpHandler:
if (context.Request.RawUrl == "/xxxx.jpg")
{
context.Response.ContentType = "images/jpeg";
context.Response.Write(
Resources.GetBytes(Resources.BinaryResources.xxxx)
);
}
You can do the same with any static file as well as text files (*.html).
With this interface, users can use about any TFT display. Some applications, like handheld devices, may require a 320x240 3.4" display. Others, like vending machines, may need a 640x480 7" displays. What about airport informational center? Those will probably need a 12" 800x600 displays. What is important is that GHI NETMF modules can work with all these options. Through a simple call to the GHI managed libraries, a user can set the default settings for display, including resolution, HSYNC, VSYNC and clock.