Buy Official Merchandise!
Forumwarz is the first "Massively Single-Player" online RPG completely built around Internet culture.

You are currently looking at Flamebate, our community forums. Players can discuss the game here, strategize, and role play as their characters.

You need to be logged in to post and to see the uncensored versions of these forums.

Log in or Learn about Forumwarz

Role Playing
Switch to Civil Discussion Role-Playing
Rant Why use MYSQL for Images?

STGill

Avatar: Code (Blue)

[Dev-Null]

Level 14 Hacker

DELETED ACCOUNT

My friend and I were having an interesting discussion, why use MySQL to store images?

I have been working on a set of PHP scripts for a project, part of this project requires that the images be sotred in MySQL rather than written to the drive.

Some scripts, create a new directory and write the file to the disk, while others like mine, store it as a BLOB in MySQL.

I think it makes migration easier, and it makes it easier to control who can and cannot view a set of images. In some cases, like remote hosting you may not have wrote permissions to the drive or scripts may not be able to create new directories.

Can anyone else think of any advantages to storing images in a database rather than as a hard file?

quangntenemy

Avatar: 14557 2011-10-31 11:07:55 -0400
59

[WeChall]

Level 69 Troll

:ronpaul: :****ing sucks:

It’s just more convenient that way. No need to synchronize data between database and disk storage.

But really, some noobs don’t even know how to store resources anywhere other than database.

In term of performance, storing images on disk is always the best choice.


Log in to see images!

Log in to see images!

Log in to see images!

Log in to see images!

Log in to see images!

Log in to see images!

 Buying a lot of zomg im so fat.xpeg – 500 each 

Log in to see images!

STGill

Avatar: Code (Blue)

[Dev-Null]

Level 14 Hacker

DELETED ACCOUNT

quangntenemy Posted:

It’s just more convenient that way. No need to synchronize data between database and disk storage.

But really, some noobs don’t even know how to store resources anywhere other than database.

In term of performance, storing images on disk is always the best choice.

Well I started with storing to disk use fwrite etc, but after writing a captcha program I really got interested in using header data to output images.

I have never really done a benchmark to compare MySQL image output to Disk output but since technically when using SQL the data must be read twice (Once to read the SQL database and again to read the Image data)

It is also more RAM intensive it seems.

STGill edited this message on 08/19/2009 12:33AM

ChilePepino

Avatar: 101005 2010-01-24 16:17:40 -0500
5

[Full of SbumSS]

Level 35 Permanoob

Well, spf357 really rocks.

——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————-

Internet Delay Chat
Have fun playing!
To chat with other players, you must Join Forumwarz or Log In now!