Page 1 of 1

Help with PHP pictures in mysql

Posted: Wed May 27, 2009 12:19 pm
by gord1020
Hey all,

OKay so I finally have my search function working using PHP and mysql!! take a look here: http://stevenspraguememorialrun.com/search.php JUST TYPE "31" in the bib field. As you can see after you type 31 you get a page with all the results for that Bib as well as a picture with the person in it. I achieved this by adding another column to my mysql table called "image" then typed in "<img src="/racepics/DSC_0014.jpg" into that specific row.

It works beautifully, the problem is I need to do this with over 300 people!! I cannot sit there and manually enter each image file name into the correct participants data field.

Does anyone have any suggestions? I did take the liberty of tagging each photo's metadata with the appropriate bib number.

Also something to note: some participants are in more than one photo. I don't know if that would change anything.

Thank you so much!!!

Re: Help with PHP pictures in mysql

Posted: Wed May 27, 2009 12:32 pm
by anand
Try doing this. In the table images, just keep the links. like "http://www.xyz.com/abc.jpg". By this, all users will have their own image slot. Just ask them to update their image links in that cell.

Now, in html, do this...

Code: Select all

 
<?php
$image = mysql_query("SELECT images FROM table_name WHERE bib='31' LIMIT 1;");
?>
 
<html>
<img src="<?=$image ?>">
 </html>
.
 
Hope this will help you

Re: Help with PHP pictures in mysql

Posted: Wed May 27, 2009 1:15 pm
by gord1020
I'm afraid I don't understand what you're describing. Won't I still somehow have to go through and copy and paste each and every image file name into the sql table?

Sorry,
Thank you!!!

Re: Help with PHP pictures in mysql

Posted: Wed May 27, 2009 1:51 pm
by anand
gord1020 wrote:I'm afraid I don't understand what you're describing. Won't I still somehow have to go through and copy and paste each and every image file name into the sql table?

Sorry,
Thank you!!!
Not really. You can let your users do that.

Can you again please explain what you want to say. Means, what you want to do.

Re: Help with PHP pictures in mysql

Posted: Wed May 27, 2009 2:42 pm
by gord1020
i have a search function that i want to make display pictures of a specific race participant. Basically I have pictures that are tagged with numbers (in their metadata), and I need to be able search these pictures.

Re: Help with PHP pictures in mysql

Posted: Wed May 27, 2009 5:17 pm
by pickle
Have a separate table that matches up an image to a user. There could be multiple entries for a given image, and multiple entries for a given user. You'll have to modify your search to search this other table.

Storing the information in metadata might be neat, but won't really be practical for this application, as you don't want to have to open the meta data of each image, when there's going to be so many. Find a way to convert that meta data into the image => user matchup.