I have a table that stores instruction book pages. while working on the app and finished adding an instuction book, I found that that the table was over 200MB, however the PDF containing the pages was only 70MB 438 Pages.
The problem is that it saves the images as max quality. now i want to make a script that goes over every record opens the images and saves it again as medium compression.
I've made a record set and a loop to go through each record to change the compression, but but the app crashes half way the process.
No matter how i Change the code, it always crashes.
So i took an other approach and make a for loop of 200 records. This wend well, but it didn't change the file size of the database???
The runtime error is an UnsupportedOperationException
, as shown here:
This is the code:
dim rs as RecordSet
rs=lego.LegoData.SQLSelect("SELECT * FROM Books")
dim resize as Picture
while not rs.EOF
resize = picture.FromData(rs.Field("intructions").StringValue)
rs.Edit
rs.Field("intructions").StringValue = resize.GetData(Picture.FormatJPEG, Picture.QualityMedium)
rs.Update
rs.MoveNext
wend
Somehow it reads NIL
after 200 records, but it's not NIL
.
The error is not happening every time at the same record, it has its own will?
Any suggestions? I want to build-in a book image compression function as well so people can make the exported manual smaller.