Well the datatype would be a blob. But personally I would just have pointer to the
photos on the server.
In other words... you have the id of the row for that club and you can name the photo
photo_$id.jpg and the logo logo_$id.jpg
Here's a snippet you can take a look at for uploading the files from an admin page.
Check out php.net for more info.
But at least it will give you a place to start looking. I also use GDLib to create
thumbnails, manipulate the size if it's too big etc.
if (isset($_POST['action'])) {
$sql->Insert("INSERT INTO photo_item (unum, cat, cutline, create_date, hsize, vsize)
VALUES ( $HTTP_COOKIE_VARS[unum], $_POST[cat], '$_POST[cutline]', now(), 0,0)");
$affected_rows = $sql->a_rows;
$lastid = mysql_insert_id();
/* If we have an photo let's move it */
if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{
move_uploaded_file($_FILES['userfile']['tmp_name'], "pics/$lastid.gif");
} else {
/* No photo then send error and delete db entry */
$sql->Delete("DELETE from photo_item where id = $lastid");
echo ("Error no photo uploaded");
Die();
}
} else {
Show some form here
echo "<h1>Add a photo</h1>\n<p>\n\n";
echo "<form action=\"\" enctype=\"multipart/form-data\" method=\"post\">";
echo "<input type=\"hidden\" name=\"action\" value=\"1\">";
echo "<TABLE border=\"0\">";
echo "<tr><td>";
echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1000000\">";
echo "Photo: </td> <td><input name=\"userfile\" type=\"file\">";
echo "</td></tr>";
}
*********** REPLY SEPARATOR ***********
On 27/12/2002 at 9:40 AM Denis L. Menezes wrote:
>Hello friends,
>
>I am making a website for our school. My requirement is that when any
>student searched for a particular club, the logo of the club abd the
>chairperson's phot should automatically be shown dynamically on the top of
>the page. For this to be done, I have three questions, if any of you could
>please help me :
>
>1. Can I place these photos and logos in the MySQL database, If so, what
>field type?
>
>2. How can I make the admin page upload the photos and logos to the
>database?
>
>3. How do I display these photos dynamically on the output webpage?
>
>I know I am asking many questions, but none of the PHP books I own have
>the solutions for this.
>
>best regards
>Denis
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php