Real Estate Forums

MLS listings and IDX Solutions Discuss implementation of MLS / IDX solutions, MLS providers and how to improve conversion using the multiple listings service available in your area.

Reply
 
Thread Tools Display Modes
Old 01-13-2008, 08:09 PM
FProps FProps is offline
Advancing Webmaster
 
Join Date: Dec 2007
Location: Connecticut
Posts: 32
FProps is on a distinguished road
Send a message via AIM to FProps
Default Uploading images INTO database.

I think it would probably be easier to upload the images directly into its own database. Is this realistic to do?
Reply With Quote
Old 01-13-2008, 08:36 PM
webmaster's Avatar
webmaster webmaster is offline
Administrator
 
Join Date: Apr 2004
Posts: 12,225
webmaster is on a distinguished road
Default Re: Uploading images INTO database.

The images themselves, or the filenames / paths to the images? It makes sense to store locations and counts for images, but why the physical images themselves?
__________________
Webmasters who spend their energies upholding the spirit of the basic principles [Of Google] will provide a much better user experience and subsequently enjoy better ranking than those who spend their time looking for loopholes they can exploit. Google.com
Reply With Quote
Old 01-13-2008, 09:41 PM
genesplitter genesplitter is offline
New real estate webmaster
 
Join Date: Apr 2006
Posts: 2
genesplitter is on a distinguished road
Default Re: Uploading images INTO database.

I work with uploaded images often. I suggest to keep your images in their own folder and the filenames in the database, or even better, dynamically create folder names keyed to a unique value (like the MLS ID). That way, you can programatically check if the folder exists, and if so display all images for that property without a database lookup!

http://www.donaldlee.net
Reply With Quote
Old 01-14-2008, 12:57 PM
DMike DMike is offline
Real Estate WebMaster
 
Join Date: Sep 2006
Posts: 156
DMike is on a distinguished road
Default Re: Uploading images INTO database.

As i know, the information you store in the database it's stored in files as well. So if you have a file on your hard, you have it in the database, the content of that file is in both cases on hard somewhere. If you keep it in the database, most chances are that some extra info about the row with the file is added. I'd say it's better to keep the file on hard and maybe the filename in the database
Reply With Quote
Old 01-21-2008, 09:51 AM
captainm captainm is offline
New real estate webmaster
 
Join Date: Jan 2008
Posts: 21
captainm is on a distinguished road
Default Re: Uploading images INTO database.

You can store the images as a BLOB in your database however there's several reasons not to.

It'll make your database huge
If you convert to a different database type your BLOB might not be compatible
Not storing it in the database gives you access to these images in different ways such as FTP
There will be a much faster load time on your website if you don't store in the database (Don't have to call a SQL query for the images, then stream it to the user, etc..).
__________________
Want more real estate leads?
http://www.housebuyersnational.com/investors.php
Reply With Quote
Old 04-06-2008, 08:39 PM
FProps FProps is offline
Advancing Webmaster
 
Join Date: Dec 2007
Location: Connecticut
Posts: 32
FProps is on a distinguished road
Send a message via AIM to FProps
Default Re: Uploading images INTO database.

Ok, I thought I had everything figured out, but my residential image script times out when it comes to putting the file names into a data base. Heres how it works ..

- Delete old info table and read in new mls info to res_info_database table
- Delete old image table and create new empty res_image_database table
- Copy new image .zip files from MLS server to my server.
- Unzip the .zip files
- Make an array of all file names in the image folder. (old and new)
- Explode the file name to extract the mls number the file belongs to.
- IF the mls number is not equal to a res_info_table entry then delete the file
- IF the mls number is equal to an info database entry then insert/update image file name for the proper image# on the mls# row in the res_image_table)

example: image data schema ..
mlsnumber int(10) ..
image01 char(40) ..
image02 (char40) ..
image03 (char40) ..
image04 (char40) ..
ect ..

The problem is my script times out when inserting the image names into the database. The MLS number is a PRIMARY INDEX and I set the mysql SELECT statement to only scan for the mls number and a LIMIT = 1, but it still times out. Is there an optimization I am missing? Am I going about it all wrong by trying to scan the entire image folder each update?

Last edited by FProps : 04-06-2008 at 08:41 PM.
Reply With Quote
Old 04-07-2008, 08:09 AM
captainm captainm is offline
New real estate webmaster
 
Join Date: Jan 2008
Posts: 21
captainm is on a distinguished road
Default Re: Uploading images INTO database.

Can you post your query
__________________
Want more real estate leads?
http://www.housebuyersnational.com/investors.php
Reply With Quote
Old 04-07-2008, 11:08 AM
FProps FProps is offline
Advancing Webmaster
 
Join Date: Dec 2007
Location: Connecticut
Posts: 32
FProps is on a distinguished road
Send a message via AIM to FProps
Default Re: Uploading images INTO database.

Heres what the code looks like, I changed variables and made it something like seudo code ..

$mydir = >>image_directory<<

while (>>next_file<< != null) // read down list of image files
{
$next_file = explode('_', $file); // break image name into parts

$result = mysql_query("SELECT MLSnumber FROM info_list WHERE MLSnumber = '$nextfile_mlsnumber' LIMIT 1"); // see if current image mlsnumber is still in the info database.

if (mysql_num_rows($result) == 0) // if not in database, delete
{
delete($next_file);
}
else // if it is in database, add filename to image_table
{
$result = mysql_query("SELECT mlsnumber FROM res_images WHERE mlsnumber = '$nextfile_mlsnumber' LIMIT 1");

if (mysql_num_rows($result) == 0) // if not currently in image_database, add new row
{
mysql_query("INSERT INTO ctmls_res_images (mlsnum) VALUES ('$filearray[0]')");
}

// insert file_name into image column for given mlsnumber row ..
switch (nextfile_imagenumber)
{
case 101 : mysql_query("UPDATE res_images SET image01 = '$nextfile' WHERE mlsnumber = '$next_file'"); break;
case 201 : mysql_query("UPDATE res_images SET image02 = '$nextfile' WHERE mlsnumber = '$next_file'"); break;
ect ...
}
}
}
Reply With Quote
Old 04-07-2008, 11:30 AM
captainm captainm is offline
New real estate webmaster
 
Join Date: Jan 2008
Posts: 21
captainm is on a distinguished road
Default Re: Uploading images INTO database.

How many times does that loop run generally?
__________________
Want more real estate leads?
http://www.housebuyersnational.com/investors.php
Reply With Quote
Old 04-07-2008, 11:52 AM
FProps FProps is offline
Advancing Webmaster
 
Join Date: Dec 2007
Location: Connecticut
Posts: 32
FProps is on a distinguished road
Send a message via AIM to FProps
Default Re: Uploading images INTO database.

The while loop is for every image in the folder.. so about 1450 times :X
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming / Database Technical RonnieG Metrolist Development 4 11-13-2007 10:00 AM
Problems uploading pictures. Morristown Blogs 5 09-29-2007 08:16 PM
Vector Images Agnafl Webmasters Toolkit 4 07-16-2007 07:48 PM
Image(s) Not Found Red X Calgary Agent REW CMS 1 Questions 1 05-07-2007 02:04 PM
Uploading Images Memphis REW CMS 1 Questions 7 04-14-2006 04:46 PM



Main Navigation

Popular Services

IDX Coverage Areas

Spiders Welcome

All times are GMT -7. The time now is 02:44 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.