Dear Koen,
thanks for the answer.

Yes, that works. However, while trying to let Wt guess the image size, the
second argument, according to the doc, should be a const std::string &
file, the local filesystem as *file*.

I've tried with WFileUpload's clientFileName, which is the only local
resource I can reach according to the API, but I get an error at
std::string.

Which is the parameter I need to provide?

Thanks again,
JON HAITZ



On 10 June 2013 12:46, Koen Deforche <k...@emweb.be> wrote:

> 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
>
>
------------------------------------------------------------------------------
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

Reply via email to