BuddyDev

Search

media storage

  • Participant
    Level: Enlightened
    Posts: 27
    Simon Parker on #4824

    a quick query.

    what was the reasoning behind using the wordpress media folder to contain user uploads?

    Reasons not to do it (from my point of view)

    can no longer use media folder easily for my own images as cannot find them easily any more.
    media folder may end up containing hundreds of thousands of images per month
    Cannot implement any sort of folder level caching similar to magento or vbulletin that has the first two characters of the image name as their initial folder so 1234.jpeg would be stored in media/1/2/1234.jpg which allows easy seperation

    Albums etc cannot simply be accessed because the relationship between the images and albums is in the post meta

    And a second general question why does everything in wordpress go through post meta instea dof being saved seperately. seems like a recipe for disaster as every post, page, picture, gallery, custom post typoe ends up being very bloated and would slow the site performance as more and more content is aded by every plugin

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #4825

    Hi Simon,
    Thank you for posting.

    1. We are not using WordPress media folder architecture completely. We are only using the WordPress base uploads directory. After that, Here is the terminology we use to save media

    uploads[WordPress Base Uploads Directory]
    –mediapress[MediaPress base directory]
    —-members[User Uploads]
    ——user_id(actual value, the user whose media will be stored)
    ——–gallery_id[Actual media of all the gallery is stored here]

    So, if you want to see all the media of user id 3, you will go to uploads/mediapress/members/3 and see all the gallery as folder there.

    The thing is MediaPress storage architecture is pluggable and you can create your own storage manager by extending MPP_Storage_Manager class.

    https://github.com/buddydev/mediapress/blob/master/core/storage/class-mpp-storage-manager.php

    Here is actual implementation for local storage which is used in MediaPress by default.
    https://github.com/buddydev/mediapress/blob/master/core/storage/class-mpp-local-storage.php

    And here is how to plug it in

    https://github.com/buddydev/mediapress/blob/master/mpp-init.php#L153

    Once you do that, you can select it from the MediaPress settings.

    The goal of MediaPress storage manager is to allow any kind of storage strategy to be used.

    I hope that clears your first two points.

    Everything goes to post meta as it provides a uniform and easy to use flexible key/value store. It is not going to hurt much(unless you are searching) as post meta is bulk cached(in loops) and individual access do not trigger database queries.

    Hope that helps.

You must be logged in to reply to this topic.

This topic is: not resolved