Page 1 of 1
how to store and display photo with mySql and PHP?
Posted: Mon Jul 07, 2003 2:09 pm
by tonguim
Good evening (in my country it is 19h00)
I would like to build a directory of my graduate class, with the name, the adresse,..., and the photo of everybody. I would like to use PHP and mySql.
Please, how can i store the photos, and display each one with the informations of its owner? Thanks you very much.
Posted: Mon Jul 07, 2003 2:26 pm
by cactus
Have a look at:
Ref : Mig - "My Image Gallery"
http://mig.sourceforge.net/
Ref : Photogallery PHP script
http://tuma.stc.cx/gallery.php
Ref :
http://freshmeat.net/search/?q=photo+ga ... filter=183
These should give you an idea for your own application.
Regards,
Posted: Mon Jul 07, 2003 11:23 pm
by pistolfire99
tonguim:- Do you mean something like this...
http://www.i2l2.com/kpsnatest/zzzdelete0.php
I am also doing something similar for my community, however I am using Dreamweaver MX (30 day full version trial avail. on their website) and I write the scripts by hand, I like the pre-built code snippets within dreamweaver, makes certain tasks easier, that way I can concentrate on core PHP and MySQL and not worry about semi-colons and so on.
BTW, I am not soo good with PHP, sortof intermediate.
Regards,
Pistolfire99
Posted: Tue Jul 08, 2003 4:58 am
by tonguim
Thank you very much to Cactus and Pistolfire99.
Pistolfire99, is it possible to display at the same time the photo, and the database data (email, name, adress ...)? I would like also that the pictures be display as faster it is possible.
Posted: Tue Jul 08, 2003 11:14 am
by pistolfire99
tonguim:- Yes, it is. The 'ONLY' limitation is how well you know how to use DreamweaverMX, PHP & MySQL. I dont mean any disrespect, but one can make very complex websites using the above mentioned tools and programming knowledge. If you are familiar with DreamweaverMX and consider yourself an average PHP programmer(like myself), then let me know and I will post a small tutorial.
Check out the above link again, I made some changes.
I would like also that the pictures be display as faster it is possible.
I am not sure about this, since this depends on a lot of other variables. However I am not storing the images in the database, but only the path to the images.
Good Luck,
Pistolfire99
Posted: Tue Jul 08, 2003 12:09 pm
by tonguim
I don't have DreamweaverMx, and never work with it. However, if i get it, it will not be difficult for me to learn it. I thought it was possible to build the directory of my graduate class with PHP and mySql.
Posted: Wed Jul 09, 2003 1:06 am
by Darkside
Dreamweaver is only a HTML program obviusly you need to use html to display this information on a website.
Posted: Wed Jul 09, 2003 2:14 am
by m3mn0n
tonguim wrote:
I thought it was possible to build the directory of my graduate class with PHP and mySql.
It
IS possible. If you want someone to do it for you I can be of service to you.
Mail me;
sami@smx.ca
Posted: Wed Jul 09, 2003 4:20 am
by Judas
I think he just wan't to know how to ad binair's to his mysql.
Is this correct?
Posted: Wed Jul 09, 2003 12:10 pm
by pistolfire99
Darkside:- Dreamweaver is only a HTML program obviusly
That is not entirely true. Dreamweaver is an HTML editor + a lot lot lot more. I also use it as my default PHP editor, since I like the layout and code highlighting and such. I am aware that other editors also have these features, but its just that, this is what I first started with and hence this is what I am sticking with.
tonguim:- You can get a full working copy of DreamweaverMX (30 day trial) from macromedia's website @
http://www.macromedia.com/
Hope this helps,
Posted: Thu Jul 10, 2003 3:45 am
by tonguim
I think he just wan't to know how to ad binair's to his mysql.
Is this correct?
If i found the way to store images in a mySql database, i think it could be simplify things for me.
Posted: Thu Jul 10, 2003 9:43 pm
by macewan
you upload the image a folder on the server and store the name of the image in mysql
Posted: Wed Jul 16, 2003 4:55 am
by tonguim
It is about the directory i would like to create: i would like to display in a table the photo of each person with beside some informations about him, like name, adress, country etc ... . I wrote a code but it doesn't give me any results; please can you help me to make the following code gives me the results i hope? Below, my code:
Code: Select all
<?
require ("gtfglobals.php"); // script that contains the hostname, password, database name and table name
echo"<td align = "center"> <h2>Directory of the 4th graduate class of the Adventist University Cosendai</h2></pre>";
echo"<table width=100% border=1 bgcolor=white bordercolor="black" >";
echo"<tr width=100% bgcolor="silver"><td colspan=$colonspan align="center"><font size=2 color=#330099 face="arial black"> $reponse </font></td></tr>";
echo"<tr width=100% bgcolor=#CCCCCC><td width=10% align="center"><b>Photo</<small></b></td><td width=25% align="center"><b><small>Nom(s) et Prénom(s)</small></b></td><td width=20% align="center"><b><small>Adresse</small></b></td><td width=10% align="center"><b><small>Pays</small></b></td><td width=20% align="center"><b><small>Intérêts</small></b></td><td width=30% align="center"><b><small>Projets</small></b></td></b></tr>";
$searchStmt ="SELECT * from $nomTable";
while ($var=@mysql_fetch_array($searchStmt))
{
echo"<tr width=100%>";
$homedir="photo/";
$imagephoto=$varї"login"].".jpg"; //echo"$imagephoto";
// "ouverture" du répertoire
$dir=opendir($homedir);
$trouve="false";
while (($file = readdir($dir))&&($trouve=="false"))
{
//echo"$file";
// comparaison du nom du fichier avec la photo à afficher
//$trouve=1;
if ($file=="$imagephoto")
{
$trouve="true";
$photo=$file;
}
else
{
$trouve="false";
$photo="";
}
}
$nom=$varї"nom"];
$prenom=$varї"prenom"];
$adresse=$varї"adresse"];
$pays=$varї"pays"];
$interets=$varїinterets];
$projets=$varї"projets"];
echo"<td width=10% align="center" border=0><a href="http://lombila.univ-ouaga.bf/editphp/aff_image.php?photo=$photo&nom=$nom&prenom=$prenom&adresse=$fadresse&pays=$pays&sinterets=$interets&projets=$projets"><img src="photo/$photo" width=75 height=75 align="left" border=0></a></td>";
echo"<td width=25% align="center" border=0 bgcolor=$couleur1>";
echo"<b><small>$nom $prenom</small></b> ";echo"</td>";
echo"<td width=20% align="center" border=0 bgcolor=$couleur1>";
echo"<b><small>$adresse </b></small>";echo"</td>";
echo"<td width=10% align="center" border=0 bgcolor=$couleur1>";
echo"<b><small> $pays</small></b></td>";
echo"<td width=20% align="center" border=0 bgcolor=$couleur1>";
echo"<b><small> $interests=$interets</small></b></td>";
echo"<td width=30% align="center" border=0 bgcolor=$couleur1>";
echo"<b><small> $projets=$projets</small></b></td>";
// fin de l'affichage
closedir($dir);
}
?>
Thank you.
