OnRequestHTTPImage not working correctly

  • I tried to display an Indy 10 Message in a TWPRichText. I followed the documentation and the sample but it doesn't seem to work. It displays the text correctly but where the actual images should be placed there are only red squares.

    You can download a sample program that illustrates the wrong behaviour. You can download it from here: http://www.niftybits.de/downloads/HttpImageBug.zip

    Just run it and you'll see the red squares.

    The images are read in correctly; if I save them in the OnRequestHTTPImage to disk they are correct.

    For a test I also tried: instead of loading the images from the mail l loaded them from disk directly. This had the same wrong result.

    It has probably to do that TextObject.Width and .Height are 0 after:

    Code
    TextObject.LoadObjFromStream(URL, lStream);

    I cannot debug it further since I don't have the source code. Therefore I would be very happy if Julian could have a look at it.

    Regards,
    Dirk.

  • There were two things I had to change to make it work:

    1. The images I wanted to include were PNG images. By browsing through this forum I found out that I need a special package that makes PNG images work. I chose GraphicEx.

    2. The URL was a bit cryptic and didn't have the image extension at the end. So I figure that TWPRichText couldn't determine what kind of graphic handler to work with. So I changed the url so that it has a standard extension and then it worked.

    There is only one thing left that is not correct but I will post that in another thread: the PNG image has transparent areas and these areas are displayed as black which looks ugly since my background is white. Maybe I need to set some property in GraphicEx but I haven't found anything yet.

    Regards,
    Dirk.

    • Offizieller Beitrag

    Hi,

    transparent PNGs only work with PNGLib - I find that better than GraphicEx.

    WPTools 6 has been further improved here - it tries to render the images at the device resolution, not the scaled resolution.

    You ca deactivate scaling in FormatOptions - " wpfAlwaysFormatWithScreenRes " - thats better for display at the cost of printing quality.

    Regards,

    Julian