salvo le immagini in questo modo:
Codice PHP:
........
$query = 'insert into images (image_caption,image_date,image_category) values ("' . $image_caption . '","' . $image_date . '","' . $image_category . '")';
$result = mysql_query($query, $db) or die(mysql_error($db));
// recupera il valore image_id generato in fase di inserimento
$last_id = mysql_insert_id();
// assicuriamo che l'immagine non sovrascriva le altre esistenti
$imagename = $last_id . "_" . $_POST['category'] . '.jpg';
$nome = imagejpeg($image, $dir . '/' . $imagename, 100);
imagedestroy($image);
ho un problema in fase di visualizzazione:
Codice PHP:
<?php
include_once 'config.php';
$query = "select * from images";
$result = mysql_query($query, $db) or die(mysql_error($db));
echo "<table border=\"2\" cellpadding=\"3\" cellspacing=\"1\">";
echo "<tr>";
echo "<td>Descrizione</td>";
echo "<td>Data</td>";
echo "<td>Categoria</td>";
echo "<td>Foto</td>";
echo "</tr>";
while ($riga = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $riga['image_caption'] . "</td>";
echo "<td>" . $riga['image_date'] . "</td>";
echo "<td>" . $riga['image_category'] . "</td>";
echo '<td>[img]images/' . che devo mettere?? . '[/img]</td>';
echo "</tr>";
}
echo "</table>";
?>
in pratica mi si vede tutto ma nn carica la foto.
il problema sta nel nome del file solo che ho provato tutto quello che mi viene in mente.
che devo mettere per caricare anche la foto??
ps: so bene che se impostassi il nome con l'id della foto caricata mi basterebbe mettere un $rig[0], ma a me serve salvare la foto anche con il nome della categoria.