Convert Picture to Jpeg

Hi there - I am developing a commercial web app with Xojo!

My problem is that I can’t seem to upload large picture files on the MySQL database. The field type is a longblob - which should be able to hold 4gb
It simply doesn’t load until I use a small picture.
I think I could get around this by upload my picture file as a Jpeg - bigger pictures and less file size.

Is there a way to convert in real time a picture to a jpeg (without saving it somewhere)

here’s some code that doesn’t work:

dim p as Picture=source if rs=nil then rec = New DatabaseRecord rec.Column("AssetID")=a rec.PictureColumn("APImage")=p.FormatJPEG db.InsertRecord("AssetPhotos",rec) db.Commit else dim pp as Picture rs.Field("APImage",Picture).PictureValue=p end if

Is this because you are trying to insert a picture which is millions of pixels , 32bit color space and uncompressed for display?
Maybe save the JPG to disc or a memoryblock , and then insert the binary file that is generated (which is compressed for saving)

Perhaps try working with the binary data directly and skip the use of PictureColumn. So something like this:

rec.BlobColumn("APImage") = pic.GetData(Picture.FormatJPEG, Picture.QualityHigh)

Or for a RecordSet:

rs.Edit rs.Field("APImage").Value = pic.GetData(Picture.FormatJPEG, Picture.QualityHigh)