Ciao a tutti.
Avrei bisogno di un aiutino!
Ho 2 file printfoto.php e news.php che funzionano tranquillamente in locale, caricando e mostrando una news e relativa foto ridimensionata da un database, ma non fuzionano in remoto.
Ovvero quando li carico su altervista , www.ctedintorni.altervista.org/news.php mostra il campo testo, ma non la foto.
Da cosa dipende?
Il codice dei 2 file č:
printfoto.php
Codice PHP:
<?php
@mysql_connect("localhost", "root", "") or die("Connessione fallita !");
@mysql_select_db("PORTALE") or die("Selezione Database fallita !");
// Esegui la query
$query = "SELECT foto FROM news ";
$result = mysql_query($query) or die('Query non valida: ' . mysql_error());
$row = mysql_fetch_array($result);
// Creazione dell'immagine temporanea
$t_img_name = tempnam ("/tmp", "timg");
$t_img = fopen($t_img_name, "w");
// $row['immagine'] č il campo blob del database
fwrite($t_img, $row['foto']);
fclose($t_img);
// Qui eseguo le modifiche desiderate sull'immagine
Header("Content-type: image/jpeg");
list( $width, $height, $type ) = getimagesize( $t_img_name );
$new_width = 300;
$new_height = $height / $width * $new_width;
if ($type == 1) $src_img = imagecreatefromgif( $t_img_name );
if ($type == 2) $src_img = imagecreatefromjpeg( $t_img_name );
elseif ($type == 3) $src_img = imagecreatefrompng( $t_img_name );
$im = Imagecreatetruecolor( $new_width, $new_height );
imagecopyresampled( $im, $src_img, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
Imagejpeg($im,'',95);
ImageDestroy($im);
// cancello il file temporaneo creato
unlink($t_img_name);
mysql_close($db);
?>
news.php
Codice PHP:
<link href="stile.css" rel="stylesheet" type="text/css">
<?php
//$idn1= $_GET["idn1"];
@mysql_connect("localhost", "root", "") or die("Connessione fallita !");
@mysql_select_db("PORTALE") or die("Selezione Database fallita !");
$query = "SELECT foto,news1, Type from news ";
$select = @mysql_query($query) or die("Query fallita !");
$result = @mysql_fetch_array($select);
$notizia=$result["news1"];
//$idn1=$result["idn1"];
$foto=$result["foto"];
/*list( $width, $height, $type ) = getimagesize( $foto );
echo $width; */
echo "<img src=printfoto.php>"; //carica l'immagine
echo"
";
echo"
";
echo $notizia;
?>
Qualcuno mi sā aiutare. Sono veramente bloccato.
Grazie!