stijnsanders / TMongoWire

Delphi MongoDB driver
MIT License
102 stars 37 forks source link

Images lose quality when saving the TMongoWire. #26

Closed OneideLuizSchneider closed 9 years ago

OneideLuizSchneider commented 9 years ago

hi I have a problem when I upload large files such as videos. They are losing quality.

So I changed the value of the const 'mongoStreamDefaultChunkSize' for $ E4E1C0, which is equal to 15000000 in decimal. With that the video did not lose more quality.

Same problem happens with images, if I leave the default value of const 'mongoStreamDefaultChunkSize'.

In my view this is not correct because the database is very large. Any suggestion?

stijnsanders commented 9 years ago

If I have a look here: https://github.com/mongodb/mongo-ruby-driver/blob/master/lib/mongo/grid/file/chunk.rb#L32 and http://docs.mongodb.org/manual/core/gridfs/ the maximum is 255*1024 (=$3FC00) and that's what in the source. You cannot make the database smaller by changing this, because the database will be at least as large as the files you store in it, except for overhead which you can control to some extent, but what you need to make GridFS work.

OneideLuizSchneider commented 9 years ago

hi If you leave the standard $ 3FC00 = 255K then the files as images and large videos are corrupted if you make a test with images above 10 megabytes in demo2 he will lose quality and sometimes even becoming unreadable.

and if you do the same test with java or PHP does not lose quality.

OneideLuizSchneider commented 9 years ago

Here is a picture to show WHAT'm thinking - >> http://i.imgur.com/hwkIVyJ.jpg

original image size 23 megabytes

stijnsanders commented 9 years ago

I tried with a few big files, I don't have any trouble uploading files of even +100MB. Could you share code? Ideally a small program that only demonstrates what goes wrong.

OneideLuizSchneider commented 9 years ago

hi, I used his demo2. He only loses quality, the size is the same.

I used this image -> http://www.microsys.inf.br/publico/13_ORIGINAL.jpg

Please UPLOAD that image and after her return, then open it to see that lost quality, but the size is the same.

stijnsanders commented 9 years ago

I tried it with that image and TMongoWire\demo\example2\mwx2.exe, and get the exact binary identical file.

OneideLuizSchneider commented 9 years ago

hi..

I downloaded the new version and now worked. You made some adjustment? I have noticed that commits.

stijnsanders commented 9 years ago

I assume my recent changes solved the problem.