Pictures in FileSystem

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hello,

I know there is an option for storing pictures in file system but when i checked PictureService class in 1.9 and Database, it still store images in DB.

So basically when i import over 30,000 images my db will be oversized (for me) again.

Am i missing something? is there any way not to store pictures in DB at all?
12 years ago
Go to admin area > Configuration > Global Settings > MEdia tab. There's 'Pictures are stored into..' proeprty. Just click 'Change' button
12 years ago
If you read my post you will understand that i already know it.
However when i look at source code


public Picture InsertPicture(byte[] pictureBinary, string mimeType, bool isNew)
        {
            mimeType = CommonHelper.EnsureNotNull(mimeType);
            mimeType = CommonHelper.EnsureMaximumLength(mimeType, 20);

            pictureBinary = ValidatePicture(pictureBinary, mimeType);

            
            var picture = _context.Pictures.CreateObject();
            picture.PictureBinary = (this.StoreInDB ? pictureBinary : new byte[0]);
            picture.MimeType = mimeType;
            picture.IsNew = isNew;

            _context.Pictures.AddObject(picture);
            _context.SaveChanges();

            if(!this.StoreInDB && picture != null)
            {
                SavePictureInFile(picture.PictureId, pictureBinary, mimeType);
            }
            return picture;
        }


It stores the file with savePictureInFile, but it doesnt prevent to save on DB. It still saves binary on DB.

I am asking again am i missing something?
12 years ago
I misunsterstood you. You're right. Currently all picture metadata is stored into database
12 years ago
That solves my question why the db was growing too. :)

Can we remove that code or will something break?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.