![]() |
| ||
| Cutting amount of work and loading time? Hi There I have a very simple web gallery in php and mysql. I have noticed upon creating it, that I have several fields in my database contacting the same information (to a certain extent) and I wondered whether this would eventually put a strain on my server. Would it be possible to marry two or more of the columns together in the php coding to produce the same result? It also seems daft spending time putting the same info into the database over and over again. My database currently looks like this: http://www.equinefocus.co.uk/sampledatabase.jpg - however, this has not yet had the main image url included, which would look like the thumb field, but without the /thumbs/ directory included. For example: Each photo has a reference number, which consists of: COLOR="red"]date[/color] and an image number i.e. 2008-04-13-001 Each thumbnail consists of: directory path + date + /thumbs/ + image number + file extension i.e. /photos/eventing/2007-09-01/thumbs/001 .jpg For the thumbnail, would it be possible to pull the directory path, date, image number from the database, have the file extension and /thumb/ section in the php code, and have all elements join together to form the link to the image? It would mean that some of the content is being used more than once (date appears in the url to the image and the reference number displayed underneath). My current code to produce the image is: <?php Bit complex, sorry! Any assistance would be appreciated. |
| ||
| Re: Cutting amount of work and loading time? merge thumb and url into image - colunm just contains name e.g 1.jpg your ref seems to be primary key and date. if true, get rid of ref. // images |
| ||
| Re: Cutting amount of work and loading time? Thanks, glad to know it is possible, can save a lot of time. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd"> End result is: http://www.equinefocus.co.uk/test_page.php - what errors have I made calling the info from the database? |
| ||
| Re: Cutting amount of work and loading time? the $info['$big_image'] is not from db it is a set varible so it should be echo $big_image and same with $info['ref'] - echo $ref; the image and ref should go below db query to get info also <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| All times are GMT -4. The time now is 2:38 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC