![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
dynamic image storing
Hi guys,
i am going to be storing hundreds of user uploaded images, and i was wondering which methode would be better, storing them directly in a SQL database or in an image folder and then automating a path name in a database field, i was starting to use the file path methode put i am totally new to coding and all things web-design and storing them in the database seems easier to implement so i am exploring the options. All advice apprieciated. Cheers. |
|
|||
|
Re: dynamic image storing
> storing them directly in a SQL database or in an
> image folder and then automating a path name in a database field I wouldn't do either. I'd save the image name in the database field, and do the path in the HTML on the page. That makes it much easier if you ever change a folder name. If the path were in the database, you'd have to change each record. -- Murray --- ICQ 71997575 Adobe Community Expert (If you *MUST* email me, don't LAUGH when you do so!) ================== http://www.projectseven.com/go - DW FAQs, Tutorials & Resources http://www.dwfaq.com - DW FAQs, Tutorials & Resources ================== "meesonator" <webforumsuser@macromedia.com> wrote in message news:gbran5$7ja$1@forums.macromedia.com... > Hi guys, > i am going to be storing hundreds of user uploaded images, and i was > wondering > which methode would be better, storing them directly in a SQL database or > in an > image folder and then automating a path name in a database field, i was > starting to use the file path methode put i am totally new to coding and > all > things web-design and storing them in the database seems easier to > implement so > i am exploring the options. > All advice apprieciated. > Cheers. > |
|
|||
|
Re: dynamic image storing
It really depends on your server environment. If you have 5 GB of storage and
are only allowed 400 MB of database usage, then database storage is probably unwise. Try both, see which performs better. You might find the following FF plugin helpful: https://addons.mozilla.org/en-US/firefox/addon/1743 |
|
|||
|
Re: dynamic image storing
It really depends on your server environment. If you have 5 GB of storage and
are only allowed 400 MB of database usage, then database storage is probably unwise. Try both, see which performs better. You might find the following FF plugin helpful: https://addons.mozilla.org/en-US/firefox/addon/1743 |
|
|||
|
Re: dynamic image storing
On Sep 29, 3:36*pm, "meesonator" <webforumsu...@macromedia.com> wrote:
> Hi guys, > *i am going to be storing hundreds of user uploaded images, and i was wondering > which methode would be better, storing them directly in a SQL database orin an > image folder and then automating a path name in a database field, i was > starting to use the file path methode put i am totally new to coding and all > things web-design and storing them in the database seems easier to implement so > i am exploring the options. > *All advice apprieciated. > *Cheers. Trust Murray on this one, he points out the best way to do this ( in my opinion ). I have done this both ways that you are asking about and found out the HARD way that Murray's suggestion is the way to go~! |
|
|||
|
Re: dynamic image storing
..oO(meesonator)
> i am going to be storing hundreds of user uploaded images, and i was wondering >which methode would be better, storing them directly in a SQL database or in an >image folder and then automating a path name in a database field, i was >starting to use the file path methode put i am totally new to coding and all >things web-design and storing them in the database seems easier to implement so >i am exploring the options. Store the necessary meta information (e.g. filename, date, title or whatever you need) in the database, but the actual image data as plain files on disk. That's the most efficient way, because then the server can deliver those images directly on request. If you would store the images in the database, then for every single image you would have to call a script, which may slow things down. Of course it may also depend on the number of images and what you're going to do with them. In some cases the DB storage might be the better choice ... Micha |
|
|||
|
Re: dynamic image storing
On Mon, 29 Sep 2008 16:06:26 -0400 Murray *ACE* said : > I'd save the image name in the database field, and do > the path in the HTML on the page. That makes it much easier if you ever > change a folder name. If the path were in the database, you'd have to > change each record. Hmmmm .... but if the path is hard coded in HTML you then have to change this in every page. Surely the way to do this is to store the location of each image in two table fields, the image name, and a path ID. The path ID can then be resolved from a "lookup table" eg. ImagePaths in order to construct the full path and file name for the image concerned. Move a directory full of images and you only have one table row entry to update to match the new location. This approach is also much more scaleable. -- Ronnie MacGregor Scotland Ronnie at dBASEdeveloper dot co dot uk www.dBASEdeveloper.co.uk |
|
|||
|
Re: dynamic image storing
On Tue, 30 Sep 2008 15:05:06 -0400 Murray *ACE* said : > I'm basing my answer on an assumption that such things are usually within > REPEAT regions on the page, thus, there's only a single path to change. I see what you mean ... but ..... I'll leave you to move your image directories around in two years time and then be able to remember which pages need updated !! <g> -- Ronnie MacGregor Scotland Ronnie at dBASEdeveloper dot co dot uk www.dBASEdeveloper.co.uk |
|
|||
|
Re: dynamic image storing
You can fix this with a one liner at any decent command line with:
perl -pi.bak -e 's/src="somepath/(.*.jpg)"/src="newpath/${1}"/' *.php And while this can be dangerous, version control exists for a reason. Or you could just use grep to find the necessary files: grep -l 'somepath' Sometimes GUIs are way more complex than good old fashioned command line solutions. [q]Originally posted by: Newsgroup User On Tue, 30 Sep 2008 15:05:06 -0400 Murray *ACE* said : > I'm basing my answer on an assumption that such things are usually within > REPEAT regions on the page, thus, there's only a single path to change. I see what you mean ... but ..... I'll leave you to move your image directories around in two years time and then be able to remember which pages need updated !! <g> -- Ronnie MacGregor [/q] |
|
|||
|
Re: dynamic image storing
On Tue, 30 Sep 2008 19:53:54 +0000 (UTC) Sean DeMerchant said : > You can fix this with a one liner at any decent command line with: > > perl -pi.bak -e 's/src="somepath/(.*.jpg)"/src="newpath/${1}"/' *.php Hi Sean Yes ... there are many ways to fix a problem, I was just trying to point out a method that prevents the problem. A good general rule for coding in any language is : "Never hard code anything that could be variable" -- Ronnie MacGregor Scotland Ronnie at dBASEdeveloper dot co dot uk www.dBASEdeveloper.co.uk |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|