Sfruttando un pò di script presi sul forum e mettendoci del mio ero riuscito ad importare le immagini nel db ed a visualizzarle (in locale con win2000 apache php e mysql), sto provando adesso su una pagina online ma non riesco a vedere le immagini, sono ormai tre giorni che provo ma non riesco a capire l'errore....L'immagine risulta caricata nel db...di seguito metto gli script che visualizzano l'immagine.....Qulcuno mi può aiutare?
script che visualizza le miniature
?>
</td>
</tr>
<tr>
<td>
<p align="center"><? if ($idfoto==1)
$foto2="<img src=MODIFICAIMMAGINEBASE.php?codice=$codice&codpos izione=2®ione=$regione>";
if ($num>=2)
echo "<a href=FOTOGRAFIA.php?codice=$codice&codposizione=2& regione=$regione>$foto2</a>";
else
echo""; ?></td>
<td rowspan="7" valign="top">
<? echo (ucfirst($testo));
echo $num;
?></td>
<td><p align="center"><? if ($idfoto==1)
$foto3= "<img src=MODIFICAIMMAGINEBASE.php?codice=$codice&codpos izione=3®ione=$regione>";
if ($num>=3)
echo "<a href=FOTOGRAFIA.php?codice=$codice&codposizione=3& regione=$regione>$foto3</a>";
else
echo""; ?></td>
</tr>
<tr>
<td><p align="center"><? if ($idfoto==1)
$foto4="<img src=MODIFICAIMMAGINEBASE.php?codice=$codice&codpos izione=4®ione=$regione>";
if ($num>=4)
echo "<a href=FOTOGRAFIA.php?codice=$codice&codposizione=4& regione=$regione>$foto4</a>";
else
echo"";
?></td>
<td>
<p align="center"><? if ($idfoto==1)
$foto5="<img src=MODIFICAIMMAGINEBASE.php?codice=$codice&codpos izione=5®ione=$regione>";
if ($num>=5)
echo "<a href=FOTOGRAFIA.php?codice=$codice&codposizione=5& regione=$regione>$foto5</a>";
else
echo""; ?>
</td>
</tr>
<tr>
<td>
<p align="center"><? if ($idfoto==1)
$foto6="<img src=MODIFICAIMMAGINEBASE.php?codice=$codice&codpos izione=6®ione=$regione>";
if ($num>=6)
echo "<a href=FOTOGRAFIA.php?codice=$codice&codposizione=6& regione=$regione>$foto6</a>";
else
echo"";
?> </td>
<td><p align="center"><? if ($idfoto==1)
$foto7="<img src=MODIFICAIMMAGINEBASE.php?codice=$codice&codpos izione=7®ione=$regione>";
if ($num>=7)
echo "<a href=FOTOGRAFIA.php?codice=$codice&codposizione=7& regione=$regione>$foto7</a>";
else
echo""; ?></td>
</tr>
<tr>
<td><p align="center"><? if ($idfoto==1)
$foto8="<img src=MODIFICAIMMAGINEBASE.php?codice=$codice&codpos izione=8®ione=$regione>";
if ($num>=8)
echo "<a href=FOTOGRAFIA.php?codice=$codice&codposizione=8& regione=$regione>$foto8</a>";
else
echo""; ?></td>
<td>
<p align="center"><? if ($idfoto==1)
$foto9="<img src=MODIFICAIMMAGINEBASE.php?codice=$codice&codpos izione=9®ione=$regione>";
if ($num>=9)
echo "<a href=FOTOGRAFIA.php?codice=$codice&codposizione=9& regione=$regione>$foto9</a>";
else
echo""; ?></td>
</tr>
<tr>
<td>
<p align="center"></td>
<td><p align="center"></td>
</tr>
<tr>
<td><p align="center"></td>
<td>
<p align="center">
</td>
</tr>
<tr>
<td>
<p align="center"></td>
<td><p align="center"></td>
</tr>
<tr>
<td colspan="3">
<p align="center"></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
script di creazione miniature ....MODIFICAIMMAGINEBASE.php
<?
include("CONNESSIONEDB.php");
mysql_select_db( $db )
or die (" impossibile aprire $db".mysql_error() );
$codice=$_GET['codice'];
$codposizione=$_GET['codposizione'];
$regione=$_GET['regione'];
$foto='foto';
$tabella=$regione.$foto;
$dbQuery = "SELECT * FROM $tabella WHERE codice=$codice AND codposizione=$codposizione";
$result = mysql_query($dbQuery);
$controllo= mysql_result($result, 0, "codposizione");
$fileType = mysql_result($result, 0, "tipo");
$fileContent = mysql_result($result, 0, "datifoto");
header("Content-type: $fileType");
include 'MODIFICAIMMAGINI.php';
$img_res = imagecreatefromstring($fileContent);
$new_img_res = resize_image($img_res, 100, 120);//setti le dimensioni massime che vuoi per la tua img
unset($img_res);
if (!$controllo)
imagecreate(10,10);
else
print_image($new_img_res, 100);
unset($new_img_res);
?>
script di resize MODIFICAIMMAGINI.php
<?
function resize_image($img_res, $maxX, $maxY) {
$actualX=imagesx($img_res);
$actualY=imagesy($img_res);
if ($actualY>$maxY){
$newY = $maxY;
$newX=($actualX/$actualY)*$newY;
if ($newX>$maxX) {$newX = $maxX; $newY = ($actualY/$actualX)*$newX;}
}elseif ($actualX>$maxX){
$newX = $maxX;
$newY = ($actualY/$actualX)*$newX;
if ($newY>$maxY) {$newY = $maxY; $newX=($actualX/$actualY)*$newY;}
}else{
$newX = $actualX;
$newY = $actualY;
}
$tmp_img_res = imagecreatetruecolor($newX, $newY);
$res = imagecopyresampled($tmp_img_res, $img_res, 0, 0, 0, 0, $newX, $newY, $actualX, $actualY);
return $tmp_img_res;
}
function save_image($img_res, $filename, $quality=100) {
imagejpeg($img_res, $filename, $quality);
}
function print_image($img_res, $quality=100) {
header('Content-Type: image/jpeg');
imagejpeg($img_res,NULL, $quality);
}
?>
link di visualizzazione immagine a dimensione normale VISALIZZAFOTO.php
if (! $link)
die ("non c'è connessione");
$codice=$_GET['codice'];
$codposizione=$_GET['codposizione'];
$regione=$_GET['regione'];
$foto="foto";
$tabella=$regione.$foto;
$dbquery="SELECT 'datifoto','tipo' FROM $tabella WHERE codice=$codice AND codposizione=$codposizione";
$result=@mysql_query($dbquery);
$filecontent=mysql_result($result,0,'datifoto');
$filetype=mysql_result($result,0,'tipo');
header("Content-Type:$filetype");
echo ($filecontent);
?>