wxHtmlWindow -> load images from string/database

Hello,

For a project I'm working on, I need to show html pages that are
stored in a database.
Showing these pages is not so hard ... wxHtmlWindow.SetPage(source)
does the trick. Linked images that are loaded from the web are also
no problem (very slow though .. known problem???), but some pages
need to load local images that are also stored in the database.
A work around would be to store the images in a temp diretory and use
OnOpeningURL to redirect to this dir.

What I would like to know if there is a cleaner or 'better' way to get
these images loaded on demand.

Regards,
Remy Cool

Remy C. Cool wrote:

Hello,

For a project I'm working on, I need to show html pages that are stored in a database. Showing these pages is not so hard ... wxHtmlWindow.SetPage(source) does the trick. Linked images that are loaded from the web are also no problem (very slow though .. known problem???), but some pages need to load local images that are also stored in the database. A work around would be to store the images in a temp diretory and use OnOpeningURL to redirect to this dir.

What I would like to know if there is a cleaner or 'better' way to get these images loaded on demand.

Yep, the pages themseleves too.

Create a wxFileSystemHandler that knows how to retrieve files from your database, and then refer to the pages and images with the new protocol specifier. For example: mydb://thefile.html. If all your links and image references are relative then I think you only need to specify the protocol for the first page when you open it with LoadPage.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks, that did the trick.

···

On Tuesday 21 October 2003 18:15, Robin Dunn wrote:

Remy C. Cool wrote:
> Hello,
>
> For a project I'm working on, I need to show html pages that are
> stored in a database.
> Showing these pages is not so hard ...
> wxHtmlWindow.SetPage(source) does the trick. Linked images that
> are loaded from the web are also no problem (very slow though ..
> known problem???), but some pages need to load local images that
> are also stored in the database. A work around would be to store
> the images in a temp diretory and use OnOpeningURL to redirect to
> this dir.
>
> What I would like to know if there is a cleaner or 'better' way
> to get these images loaded on demand.

Yep, the pages themseleves too.

Create a wxFileSystemHandler that knows how to retrieve files from
your database, and then refer to the pages and images with the new
protocol specifier. For example: mydb://thefile.html. If all
your links and image references are relative then I think you only
need to specify the protocol for the first page when you open it
with LoadPage.