Hey,
void ImageUploadWidget::paintEvent(Wt::WPaintDevice *paintDevice)
> {
> if( !m_SpoolFileName.empty() )
> {
> Wt::WPainter painter(paintDevice);
> // Actually, draw the image (just assuming the file is an image...)
> Wt::WPainter::Image* image = new Wt::WPainter::Image(
> m_SpoolFileName.toUTF8(), 200, 200);
> painter.drawImage(20, 20, *image);
> }
>
>
> Am I missing something or is there something I should understand prior to
> successfully uploading and displaying a local image?
>
Yes, Wt::WPainter::Image expects an image URL, thus a file that is
accessible from the web browser, whereas a spoolfile is a local file.
You have two options to solve this (I would recommend the first option).
- Use a WFileResource to reference the spoolfile and pass
WFileResource::url() to the WPainter::Image constructor. You can actually
pass the spoolfile name as second parameter to WPainter::Image to let Wt
itself figure out the image dimensions.
- Somehow copy the spoolfile to your docroot.
Regards,
koen
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest