Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,

How do you display image in HTM page? I see that you can't display it directly using , right? Then, how do you do it? I saw a post talking about it, but it's not clear to me. I still want to use HTM page, but with added image display. How do I tell the image where to display(rendering)? An actural sample code would be very helpful.

Does that mean I have to program the HTM page in code? If it is, what's the point of supporting HTML without supporting image display?

Inline images can be included in 3 ways.
1) Directly from file.

Notice the 3 slashes "file:///" this is a requirement.
2) Referenced from a Brew resource file

Here "?1’> .." represents the ID of the image inside the MY_RES_FILE. It is left as a numeric rather than its string equivalent due to variable interpolation.
3) Through an HTTP request

Please keep in mind that the width and height attributes are mandatory.

Inline images can be included in 3 ways.
1) Directly from file.

Notice the 3 slashes "file:///" this is a requirement.
2) Referenced from a Brew resource file

Here "?1’> .." represents the ID of the image inside the MY_RES_FILE. It is left as a numeric rather than its string equivalent due to variable interpolation.
3) Through an HTTP request

Please keep in mind that the width and height attributes are mandatory.

Thanks, I want to display an image from file, I guess I have to write it in the source code, but will I still be able to use HTM file? How do I display the image in connection with HTM file? A code snippet will be great.

Thanks, I want to display an image from file, I guess I have to write it in the source code, but will I still be able to use HTM file? How do I display the image in connection with HTM file? A code snippet will be great.

Wherever your HTML code is. :confused:

Wherever your HTML code is. :confused:

Thanks, I want to display an image from file, I guess I have to write it in the source code, but will I still be able to use HTM file, or do I have to write htm code inside the C source code? How do I display the image in connection with HTM file? A code snippet will be great.

Thanks, I want to display an image from file, I guess I have to write it in the source code, but will I still be able to use HTM file, or do I have to write htm code inside the C source code? How do I display the image in connection with HTM file? A code snippet will be great.

how about you try adding an image to one of the html pages of the netdiagnostics example to see how it works.
-Tyndal

how about you try adding an image to one of the html pages of the netdiagnostics example to see how it works.
-Tyndal

I tried it, using . It didn't work. HTMLViewer interface supports inline image, what does that mean?
Here's some stuff other people posted, but I don't understand it:
>
Inline images were not supported in the 1.1 SDK. The 2.0 SDK had a few pre-releases. Make sure you are using the latest 2.0 SDK
You can test the display of images in your IHTMLViewer example included with the 2.0 SDK. A simple way to test this is to insert inline images into this project. I simply appended the images to the first screen via the gszTests array as follows:
static const char gszTests[] =
// Intro
"[ align=center]HTML Sample"
"[a href=test:1]Help[/a]"
"[a href=test:2]Block Elements[/a]"
"[a href=test:3]Hidden Elements[/a]"
"[a href=test:4]Text Styles[/a]"
"[a href=test:5]Forms[/a]"
"[a href=test:90]Hide Viewer[/a]"
"[img width=76 height=85 src='http://www.somewhere.com/someplace/image.jpg'][p]"
"[p] Bolt.bmp [p]"
"[img width=50 height=50 src='file:///charger_bolt.bmp'][p]"
"[p] Bolt.gif
"
"[img width=50 height=50 src='file:///charger_bolt.gif'][p]"
"[p](Res Image)"
"[img width=48 height=48 src='res:/"
MY_RES_FILE
"?1'][/p]"
"\0"

[snip]
You will need to include the width and height attributes to the img tag. If this is not done the images will not appear. This requirement will go away in a later release.
For inline images from file you have to use “file:///” three slashes are required or the image will not show.
For displaying images from a resource file you need to use the image ID. 1 is the image ID inside the resource editor in the example above.
Note:
The 2.0 IHtmlViewer cannot display more than one image from an over-the-air HTML file.
[ ] syntax is used so the code can be displayed in the forum
>
Does it mean I have to write HTM code inside the C source code in order to display image? That'll be stupid.

I tried it, using . It didn't work. HTMLViewer interface supports inline image, what does that mean?
Here's some stuff other people posted, but I don't understand it:
>
Inline images were not supported in the 1.1 SDK. The 2.0 SDK had a few pre-releases. Make sure you are using the latest 2.0 SDK
You can test the display of images in your IHTMLViewer example included with the 2.0 SDK. A simple way to test this is to insert inline images into this project. I simply appended the images to the first screen via the gszTests array as follows:
static const char gszTests[] =
// Intro
"[ align=center]HTML Sample"
"[a href=test:1]Help[/a]"
"[a href=test:2]Block Elements[/a]"
"[a href=test:3]Hidden Elements[/a]"
"[a href=test:4]Text Styles[/a]"
"[a href=test:5]Forms[/a]"
"[a href=test:90]Hide Viewer[/a]"
"[img width=76 height=85 src='http://www.somewhere.com/someplace/image.jpg'][p]"
"[p] Bolt.bmp [p]"
"[img width=50 height=50 src='file:///charger_bolt.bmp'][p]"
"[p] Bolt.gif
"
"[img width=50 height=50 src='file:///charger_bolt.gif'][p]"
"[p](Res Image)"
"[img width=48 height=48 src='res:/"
MY_RES_FILE
"?1'][/p]"
"\0"

[snip]
You will need to include the width and height attributes to the img tag. If this is not done the images will not appear. This requirement will go away in a later release.
For inline images from file you have to use “file:///” three slashes are required or the image will not show.
For displaying images from a resource file you need to use the image ID. 1 is the image ID inside the resource editor in the example above.
Note:
The 2.0 IHtmlViewer cannot display more than one image from an over-the-air HTML file.
[ ] syntax is used so the code can be displayed in the forum
>
Does it mean I have to write HTM code inside the C source code in order to display image? That'll be stupid.

No, you just have to call IHTMLVIEWER_LoadStream() or IHTMLVIEWER_LoadSource() to load the proper HTML code. For the sake of convenience you can write the HTML directly in your code; otherwise, you can load a separate HTML file.

No, you just have to call IHTMLVIEWER_LoadStream() or IHTMLVIEWER_LoadSource() to load the proper HTML code. For the sake of convenience you can write the HTML directly in your code; otherwise, you can load a separate HTML file.

I'm using NetDiagnostics example in SDK2.1. It loads a HTM file (but NO image file) and displays the content. I added , but it didn't work. IHTMLVIEWER_LoadStream() is in there. My question is, can you display image in the HTM file using HTMLViewer? Or, do you have to include the HTM code in the C source code in order to display the image correctly? Because eventually, I will download and display the images from the web server.

I'm using NetDiagnostics example in SDK2.1. It loads a HTM file (but NO image file) and displays the content. I added , but it didn't work. IHTMLVIEWER_LoadStream() is in there. My question is, can you display image in the HTM file using HTMLViewer? Or, do you have to include the HTM code in the C source code in order to display the image correctly? Because eventually, I will download and display the images from the web server.

Either way will work. Be sure you followed the guidelines for including images in my earlier post.

Either way will work. Be sure you followed the guidelines for including images in my earlier post.

Echo Tests
Here's what I have in ND_MainMenu.htm. I followed your guideline and it still didn't work. I have the file on C drive.

Echo Tests
Here's what I have in ND_MainMenu.htm. I followed your guideline and it still didn't work. I have the file on C drive.

Move the image to your application directory and adjust the src accordingly. The file:/// reference must be compatible with the BREW filesystem.

Move the image to your application directory and adjust the src accordingly. The file:/// reference must be compatible with the BREW filesystem.

I found the problem. It seems that only an image of a certain size can be displayed correctly on the emulator. I used the bmp file of 16x16, bit/pix 8. Does that mean all images displayed as thumbnail have to be this size? What is the max. size that can be displayed correctly? Is there a tool that can convert other size images to this sized image?
Thanks.

I found the problem. It seems that only an image of a certain size can be displayed correctly on the emulator. I used the bmp file of 16x16, bit/pix 8. Does that mean all images displayed as thumbnail have to be this size? What is the max. size that can be displayed correctly? Is there a tool that can convert other size images to this sized image?
Thanks.

hi, i'm unable to view an image using IHTMLVIEWER when the image is an URL.
this is my code:
IHTMLVIEWER_SetData (pApp->m_pIHTMLViewer,"test img",-1);
IHTMLVIEWER_Redraw( pApp->m_pIHTMLViewer );
it works fine for: file:///image.jpg but not for an URL.
what should i do? should i parse the response, look for tags, download the image, save it on the disk and after that load it into IHTMLVIEWER?
there is not a way to do this automatically?

hi, i'm unable to view an image using IHTMLVIEWER when the image is an URL.
this is my code:
IHTMLVIEWER_SetData (pApp->m_pIHTMLViewer,"test img",-1);
IHTMLVIEWER_Redraw( pApp->m_pIHTMLViewer );
it works fine for: file:///image.jpg but not for an URL.
what should i do? should i parse the response, look for tags, download the image, save it on the disk and after that load it into IHTMLVIEWER?
there is not a way to do this automatically?