(was Picture or WebPicture ?) Web App checks more things than Desktop App

hello,

playing with xojo web for some times, I’m porting a desktop database app to the web.
I have common methods for boths apps, and in them I have classes with pictures in the desktop app.
they get their content from the database (as blobs)
and I get an exception when I read them with recordset.field.picturevalue. “data are not a picture”

it sems to come that I use picture and I should use webpicture
but is there any trick to store this in the same class at the same property ?
do I have to use 2 properties with different names (and different calling methods …)

thanks.

Picture is one to draw into as bytes in memory,
WebPicture is packaged as JPEG or PNG to send to browser,
And your blob field contains probably also a JPEG or PNG image file.

As far as i know Pictures are automaticly converted to Webpictures, no extra coding is required.
The error you mention means dat the data as they are read from the database is not in a supported pictureformat or is damaged.

yes it is this error.
problem is they are perfectly read with the “same” desktop app !

mDatabase.mCurrentUserSignature = rs.Field("user_signature").PictureValue

The image is corrupt or does not contain PNG or JPEG data

found the culprit … :slight_smile:
in fact the picture was stored in base64 encoded
so it is the web app PictureValue that checks for a valid picture
and the desktop app that DOES NOT CHECK and accept any input value.

[quote=418976:@Jean-Yves Pochez]found the culprit … :slight_smile:
in fact the picture was stored in base64 encoded
so it is the web app PictureValue that checks for a valid picture
and the desktop app that DOES NOT CHECK and accept any input value.[/quote]

Hello, you can share an example for loading an image in web browser, for example the button that uploads the image of the client.
I also want to start migrating my desktop app to the web, but in xojo web I need a datepicker for example

date picker for the web app:
https://github.com/alexvonsiebenthal/DateAndTimePickerWeb