Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Apr 2016
    Posts
    717
    Member #
    53891
    Liked
    11 times

    sql database tables

    so im getting a bit ahead of myself here, allowing myself to the end of the year to study front end stuff, but i was watching a video that went into sql databases and this question arose in my mind, how does a database store an image or video file, are tables the only way data can be stored?

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,720
    Member #
    5580
    Liked
    718 times
    They are stored as "blobs" .... google MySQL blob

    I normally store binary files in a directory and just the filename in table.


  4. #3
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Large files like videos or high resolution images should be stored like mlseim suggests. For smaller images, you can just grab the data URI and store it as a string.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    I'm not sure how MySQL works, but storing media in BLOBs can create performance issues in MS-SQL server:

    https://www.microsoft.com/en-us/rese...-a-filesystem/ <-- this article basically explains that there's a breakpoint at 1MB whereby using the file system is more efficient. Between 256K and 1MB, it depends on many factors. Under 256K, a blob is more efficient.

    Personally, I don't fully agree with the abstract. There are cases where even under 256K utilizing the filesystem would be more efficient that the article doesn't go into e.g. storing of cacheable media such as images. There are also cases whereby your database server may fill up quickly, and if you're using a cloud database server you're going to pay extra for the overhead.

    My method has always been to store the file on the server and references to the filename and possibly file info (e.g. width, height) in the database. I also make sure to store any original files that are uploaded by users, etc. in case I need to adjust them later on (e.g. put a watermark on all of them, resize the full-size web image). But to each their own, I suppose.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    Junior Member
    Join Date
    Nov 2016
    Posts
    3
    Member #
    55757
    From my previous experience, I use blob datatype to store the image into the database. I didn't know how to use it too back then. But I started to understand it by using opensource code that you can find at github. Just google blob mysql github. Hope this helping you.


    Sent from my iPhone using Tapatalk


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:13 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com