Thanks for the info JD , will keep this in mind for projects that retrieve higher number of images . Currently I'm only bringing back 1-3 images from the dir (sorry...meant dir instead of db in previous post:)at time and it doesn't seem too bad.
Cheers, Joe:) Jd Daniels <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > It has never timed out bringing back from the db... only when reading from > disk. > I think the big difference is I need to create both fancy web pages and neat > printable pages. So I need to open up an image stream to manipulate the > photo. > > I had a top level dir called photos, then a sub folder named from the row id > in the MySQL table.. so the path was always something like > /photos/1066/photo.jpg > once I hit 1000+ records (thusly, 1000+ sub dirs in photos/) ... it would > time out opening the 1066 directory. (displaying 15 records at a time) It is > much faster now with a separate table with binary data and storing just the > id for an image in the original table... then just select using an id. ( a > separate select staement seems to be faster than joining the tables) The > biggest problem tho was that I have two servers working as web farms. if one > domain needed access to the photos from another domain located on the other > server, I could not open the photos. (For resizing and such) When they are > in the db, I can get them from anywhere. > > JD > > -----Original Message----- > From: Joe Van Meer [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 19, 2002 3:04 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Re: A good tutorial > > > Hi again JD...I got to thinkin':) > > Just out of curiosity...how many images were you bringing back from the db > when your script timed out? > I store the path of my image in the db and echo it out when I need to. > > Cheers Joe:) > > > > > > Jd Daniels <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I am just going to interject a second here... sorry :P > > > > About storing images on a server... I did that for awhile, but once i hit > > 1000+ images, my scripts started timing out.(from reading the directory) > > Storing them in the DB seems to actually improve performance for php... > > Another issue is that I have one copy of a php script in my apache site > root > > folder, and use aliases to install the same script on many domains (Using > > VirtualHost containers in httpd.conf) > > > > I have gone back and forth from one system to another, and haven't found a > > perfect solution yet :) > > > > > > JD > > > > -----Original Message----- > > From: Lerp [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, February 19, 2002 12:20 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP-DB] Re: A good tutorial > > > > > > Hi Jen, here's some code I posted up in the general ng for storing in db > and > > retrieving images from db for display on your page. > > It's recommended that you stay away from storing actual images in the db. > If > > you are storing a path the code below might help you out. It select a > > firstname, and > > an image according to an id. You'll have to change the "youridentityfield" > > and "youridentity" values to suit your needs. > > > > > > > > > > > > ##################################### display image from db > > ##################################################### > > #connect to db > > $connectionToDBid = odbc_connect("ceo34deesnr43ipits", "joeyscode", > > "joeyscode"); > > > > > > // sql statement > > $sqlb = "SELECT imagepath, firstname FROM IMAGES WHERE youridentityfield > =" > > . $youridentity; > > > > # execute the query > > $resultset = odbc_do($connectionToDBid, $sqlb); > > > > $image = odbc_result($resultset,1); > > $firstname = odbc_result($resultset,2); > > > > print "<br><br><br><div align='center'>"; > > print "<table width='400' border=0 cellpadding=2>" ; > > print "<tr><td align='left'>" ; > > print "<font color='#ffffff' face='verdana'><h4>" . "Welcome back " . > > $firstname . "</h4></font>"; > > print "</td></tr>"; > > print "<tr><td align='center'>" ; > > print "<img src='" . $image."' align='center' border='0'><br>"; > > print "</td></tr>"; > > print "</table>"; > > > > # close the db connection here > > > > ##################################### end of display image from db > > ##################################################### > > > > > > > > #################################photo upload form > > #################################################################### > > > > Here's a common form that allows you to upload a file (say an image) to > the > > db > > > > <form action='upload.php' method='post' enctype='multipart/form-data'> > > <input type='hidden' name='MAX_FILE_SIZE' value='102400'> > > <P><font color='#ffffff' face='verdana' size=1>Upload Photo:</font><input > > type='file' name='userfile'><input type='submit' > > value='Upload!!!'></form></p> > > > > ################################end of photo upload form > > ############################################################## > > > > > > ############################start of upload process to db > > ################################################################ > > <?php > > > > # $userfile is the file being uploaded > > > > > > # print $userfile . "<BR>"; > > # print $userfile_name . "<BR>"; > > > > #use a time stamp plus the original file name to uniquely name the image > > before storing in db to prevent two files with the same name > > > > $timestamp = time(); > > $userfile_name = $timestamp.$userfile_name ; > > > > // copy the file being posted -- remember to escape backslashes!!! > > if(copy($userfile, "/ez/codesnipits/consultant/tempimages/". > > $userfile_name)){ > > print "<font face='Verdana, Arial, Helvetica, sans-serif' color='#663399' > > size='2'>Your picture has been uploaded successfully and has been made > > available for > > online users to view.</font><br><br><br>" ; > > } > > else > > { > > print "<font face='Verdana, Arial, Helvetica, sans-serif' > > color='#663399'>Error encountered during resume upload > process.</font><br>"; > > } > > > > $patharola = "tempimages/". $userfile_name; > > > > // insert path into database here > > # connect to db > > $connectionToDBid = odbc_connect("cdefc5onwesulertt", "joeyscon", > > "joeyscon"); > > > > session_register("consultantid"); > > $consultantid = $consultantid; > > > > # create query statement -- update image field in db using path > > $sqlr = "UPDATE CONSULTANT SET image= '$patharola' WHERE consultantid=" . > > $consultantid; > > # execute the sql statement (query) on the connection made > > $resultset = odbc_do($connectionToDBid, $sqlr); > > > > > > ?> > > > > ################################end of image to db process > > ################################################## > > > > > > Hope this helps you out :) > > > > Cheers Joe :) > > > > > > > > > > > > > > > > "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > If anyone knows of one, would someone please point me towards a good > > > tutorial on storing images in a database then fetching them out again. > > > > > > I would really appreciate it and thanks in advance! > > > > > > Jen Downey > > > > > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php