Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 779945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:00:13+00:00 2026-05-14T20:00:13+00:00

i’d like to add a media library to a custom-made CMS that is build

  • 0

i’d like to add a media library to a custom-made CMS that is build on Zend Framework and Doctrine. The goal is to build something like Worpress’s media library: you can upload media and then attach it to for example an article.

Do you have any suggestions how to start on this? How should the database be designed? Is there any code that i can (re-)use to build this? Is there any literature that I should read on this subject? Thanks!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:00:14+00:00Added an answer on May 14, 2026 at 8:00 pm

    I don’t know how WPs library is built, but it’s Open source, you can take a look.

    As for table structure, assuming you want a many-to-many link you’d want a cross reference table, something like:

    record_id (int)
    media_id (int)
    title (text)
    caption (text)
    rank (int)
    

    Then the media table would be something like:

    id (int)
    title (text)
    caption (text)
    filename (text)
    type (image|multimedia|document)
    

    Perhaps you’d also add a folder_id field to the media table, or perhaps you instead want tagging, in which case you have a third table with media_id and tag as fields (or you have tags as comma separated values in the media table).

    This will let you link one media to multiple items and one item to multiple media. It’ll let you set a title and caption for the media item and override it for a specific link. For instance you have a picture of a house with the caption of whose house it is, but in one link the caption is overwritten (in the cross reference table) with text saying how this house is an example of a certain architecture. SQL’s coalesce function will come in handy for getting the correct title and caption.

    If the content that links to media comes from multiple table, say you have a table called ‘staff’ and another called ‘products’ and they can both link to media, then the cross reference table also needs to have a table_name field. The type field is so that you can easily get only the multimedia attached to a record, or only the images; you may want to count how many documents are attached, how many images etc, basing this off the filename on each query means you have slower queries.

    One thing this doesn’t quite cater for is hosting the media off site. If you use say Amazon S3 for storing these images, then the ‘filename’ field would actually be a URL to the image. I’m just shooting this out there as something you need to take into consideration when designing the media library.

    I can’t think of any literature or code you can copy-paste though, it’s not difficult to do, though I do appreciate this can be time consuming.

    Best of luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.