Jump to content

therio7

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

therio7's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. yessssss, everything works fine now! Thanks to you!! Haha, the reason I changed the ' is because I thought my french keyboard settings did something wrong with the cut/paste of your code in my document. I'm really glad everything works fine cause its only my 2nd website using php,mysql and i'm still learning. Thank you!!
  2. I dont know if it can help but Ive made 2 print screen of my DB, one of my PhotosTable and one of my AlbumTable http://www.vitrail-entete.com/tdj/PhotosTableDB.jpg http://www.vitrail-entete.com/tdj/albumTableDB.jpg
  3. Hi, Thanks again for your time its really appreciated. http://www.vitrail-entete.com/tdj/quoi_de_neuf_test2.php Ive uploaded the new version and I got an error on line 183 any idea why ? line 183 is : if (mysql_num_rows ($result) > 0) and the new code is: $result = mysql_query(" SELECT * FROM 'AlbumTable' WHERE 'AlbumCategorie' = 'Que se passe t-il' ORDER BY 'AlbumId' DESC "); if (mysql_num_rows ($result) > 0) { $i=1; //start counter; while ($row = mysql_fetch_array ($result)) { //MY TITLE AND TEXT TABLE echo "<span class='style1'>"; echo "<table border=0 width=510>"; echo "<tr>"; echo "<td align=center><b>{$row[AlbumTitre]}</b>"; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td align=center>{$row[AlbumTexte]}"; echo "<br><br>"; echo "</td>"; echo "</tr>"; echo "</table>"; //MY LARGE IMAGE HOLDER TABLE echo "<table border=0 width=510>"; echo "<tr>"; echo "<td align=center colspan=4>"; echo "<img id='image_holder_".$i."' border='1' width='400' height='300' src='images/transparent.gif' />"; echo "</td>"; echo "</tr>"; echo "</table>"; //MY THUMBNAILS TABLE $col = 0; echo "<center>"; echo "<table border=0 width=210>"; $AlbumId = $row['AlbumId']; $result2 = mysql_query(" SELECT * FROM 'PhotosTable' WHERE 'PhotosId' = '{$AlbumId}' ORDER BY 'Date' DESC "); if (mysql_num_rows ($result2) > 0) { while($row = mysql_fetch_array ($result2)) { if ($col == 0) echo "<tr>"; $PathG = '/' . 'tdj' . $row['PhotosPathG']; echo '<td align=center><img border="1" src="'.$PathG.'" onmouseover="show_large_image(this, \''.$i.'\'); return false;" width="100" height="70" />'; echo "</td>"; $col++; if ($col == 4) { echo "</tr>"; $col = 0; } } } echo "</table>"; echo "</center>"; echo"<br><br><br>"; echo "</span>"; $i++; //increment counter +1; } }
  4. Ohhh ok I completely understand , I think I maybe forgot to mention something about website. This is a website that can be updated, add content, delete content etc.. thru the admin control panel. So I dont know in advance if there gonna be 3 or 4 or 10 image_holder. This is a loop that run thru my database and display (title, text and thumbnails) in blocks. I'm pretty sure I should add some extra code around my //MY LARGE IMAGE HOLDER TABLE comment in my code (some sort of counter that will match the number given by the javascript??) but I dont know how to code it It may not be clear and its ok if you dont understand my specific problem.
  5. Hi! thanks for the quick response it's really appreciated. I get the point of unique Id now so now my js code is: <script language="JavaScript" type="text/JavaScript"> function show_large_image(obj, num) { var large_image_obj = document.getElementById("image_holder_"+num); large_image_obj.src = obj.src; } </script> php code: //MY LARGE IMAGE HOLDER TABLE echo "<table border=0 width=510>";echo "<tr>"; echo "<td align=center colspan=4>"; echo "<img id='image_holder_x' border='1' width='400' height='300' src='images/transparent.gif' />"; echo "</td>"; echo "</tr>"; echo "</table>"; And : echo "<td align=center><img border='1' src='$PathG' onmouseover='show_large_image(this, 'x')' return false;\" width='100' height='70' />"; And there is no result on the page, Am I doing something wrong somewhere in the modifications? http://www.vitrail-entete.com/tdj/quoi_de_neuf_test2.php Thanks again
  6. Anyone can help me with my code? If you look at my page http://www.vitrail-entete.com/tdj/quoi_de_neuf_test.php When you mouseover the thumbnails on each row all the larger images appear in the top image holder (the one in the first row). I'd like to have the images appear in the large image holder just above their thumbnail set Any idea ? I'm new with php, javascript. Javascript code... function show_large_image(obj) { var large_image_obj = document.getElementById("image_holder"); large_image_obj.src = obj.src; } Php code... $result = mysql_query("SELECT * FROM AlbumTable WHERE AlbumCategorie = 'Que se passe t-il' order by AlbumId DESC"); while($row = mysql_fetch_assoc($result)) { //MY TITLE AND TEXT TABLE echo "<span class='style1'>"; echo "<table border=0 width=510>"; echo "<tr>"; echo "<td align=center><b>$row[AlbumTitre]</b>"; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td align=center>$row[AlbumTexte]"; echo "<br><br>"; echo "</td>"; echo "</tr>"; echo "</table>"; //MY LARGE IMAGE HOLDER TABLE echo "<table border=0 width=510>";echo "<tr>"; echo "<td align=center colspan=4>"; echo "<img id='image_holder' border='1' width='400' height='300' src='images/transparent.gif' />"; echo "</td>"; echo "</tr>"; echo "</table>"; //MY THUMBNAILS TABLE $col = 0; echo"<center>"; echo "<table border=0 width=210>"; $AlbumId = $row[AlbumId]; $result2 = mysql_query("SELECT * FROM PhotosTable WHERE PhotosId = '$AlbumId' order by Date DESC"); while($row = mysql_fetch_assoc($result2)) { if ($col == 0) echo "<tr>"; $PathG = '/' . 'tdj' . $row['PhotosPathG']; echo "<td align=center><img border='1' src='$PathG' onmouseover='show_large_image(this)' return false;\" width='100' height= '70' />"; echo "</td>"; $col++; if ($col == 4) { echo "</tr>"; $col = 0; } } echo "</table>"; echo "</center>"; echo"<br><br><br>"; echo "</span>"; } Anyone know the problem? Thanks in advance for your help
  7. Hi, I have a php form where I can upload 3 things into a database. 1. Image Description 2. Image category 3. Image (the image is uploaded in a folder with a unique random name, and the unique path name is inserted into the database) My script generate something like : e17fc9a207.jpg in my picture folder when I hit the form upload button. What I need now is a script that will take the picture e17fc9a207.jpg, resize it 100x100, move it to a thumbnail folder and rename it to te same name but with a _t at the end ( i.e: e17fc9a207_t.jpg ) Anyone can help me? I kind of new with php,mysql. My php code is: <?php // image directory $uploadDir = ( $_SERVER['DOCUMENT_ROOT'].'/vitrail_path/photos/' ); if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $description = $_POST['description']; $categorie = $_POST['categorie']; // get the file extension first $ext = substr(strrchr($fileName, "."), 1); // generate the random file name $randName = md5(rand() * time()); // unique file name for the upload file $filePath = $uploadDir . $randName . '.' . $ext; // move the files to the specified directory with error reporting $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } if (file_exists(( $_SERVER['DOCUMENT_ROOT'].'/vitrail_path/photos/' ) . $_FILES['userfile']['tmp_name'])) { echo $_FILES['userfile']['tmp_name'] . ' already exists. '; } if(!$_POST['description'] | !$_POST['categorie']) { die('Inscrire une description et une catégorie.'); } if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } include 'library/config.php'; include 'library/opendb.php'; $query = "INSERT INTO upload2 (name, size, type, path, description, categorie) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$description', '$categorie')"; mysql_query($query) or die('Error, query failed'); include 'library/closedb.php'; echo "<br>File $fileName uploaded<br>"; header('Location: upload.php'); } ?> And my form code is <form method="post" enctype="multipart/form-data" name="uploadform"> <h4> <table border="0" align = "center"> <tr align="left" valign="top"><td><br></td></tr> <tr align="left" valign="middle" height="10"><td><b><font size="2" face="Georgia, Arial" color="black">Description de la photo :</font></b></td><td height="10"> <input type="text" name="description" maxlength="75" size="75"> </td></tr> <tr align="left" valign="middle"><td><font size="2" face="Georgia, Arial" color="black"><b>Catégorie :</b></font></td><td> <select name="categorie"> <option selected>Animaux</option> <option>Bord de mer</option> <option>Décorations des fêtes</option> <option>Divers</option> <option>Fleurs</option> <option>Oiseaux</option> <option>Victorien</option> </select> </td></tr> <tr align="left" valign="middle"> <td> </td> <td> </td> </tr> <tr align="left" valign="middle"> <td><font size="2" face="Georgia, Arial" color="black"><b>Sélection de la photo :</b></font><br> </td> <td><input type="hidden" name="MAX_FILE_SIZE" value="60000000"> <input name="userfile" type="file" id="userfile" size="25"></td> </tr> <tr align="left" valign="middle"><td></td> <td><br> <br><img src="images/transparent.gif" width="363" height="10" border=0><input name="upload" type="submit" class="box" id="upload" value=" Ajouter la photo "></td></tr> </table> </h4> </form> Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.