Visualizzazione risultati 1 fino 7 di 7

Discussione: Problema immagine

  1. #1
    Guest

    Predefinito Problema immagine

    Ciao a tutti, non si vede l'immagine
    Codice PHP:
    echo "<img src=\"p.php?pid=$id&amp;sid=$sid\" alt=\"Mio Tamagotchi\"/><br/>";
    e nella cartella imgpet c'è questo
    Codice PHP:
    $pet = "imgpet/no.gif";
    dove sbaglio?

  2. #2
    Guest

    Predefinito

    Se non posti il codice della pagina p.php come facciamo a saperlo?

  3. #3
    Guest

    Predefinito

    Codice PHP:
    <?php
    include("core.php");
    include(
    "config.php");
    include(
    "xhtmlfunctions.php");
    connectdb();

    $pid = $_GET["pid"];
    $uid = getuid_sid($sid);
    $sid = $_GET["sid"];
    $stitle = htmlspecialchars(getstitle());
    $sdomain = htmlspecialchars(getsdomain());
    $date = htmlspecialchars(getdate2());
    $uid = getuid_sid($sid);
    if((
    islogged($sid)==false)||($uid==0))
    {
    header("Content-type: text/html; charset=ISO-8859-1");
    echo
    "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
    echo
    "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
    echo
    "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
    $pstyle = gettheme($sid);
    echo
    xhtmlhead("$stitle",$pstyle);
    echo
    "<title>$sitename Mobile</title>";

    echo
    "<body>";
    echo
    "<p align=\"center\">";
    echo
    "Non sei loggato<br/>";
    echo
    "O la tua sessione è scaduta<br/><br/>";
    echo
    "<a href=\"index.php\">Login</a>";
    echo
    "</p>";
    echo
    "</body>";
    echo
    "</html>";
    exit();
    }
    $cnt = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_tamagotchi WHERE id='".$pid."'"));
    if(
    $cnt[0]==0||$pid==""||$pid==0)
    {
    $pet = "imgpet/no.gif";
    $msg = "Missing Pet!";
    $name = "No Name!";
    $size = "2";
    $x = "10";
    $y = "30";
    $a = "22";
    $b = "41";
    $eyes = imagecreatefromgif($pet);
    $text_colour = imagecolorallocate( $eyes, 0, 0, 0 );
    imagestring( $eyes, $size, $x, $y, $msg, $text_colour );
    imagestring( $eyes, $size, $a, $b, $name, $text_colour );
    header("Content-type: image/gif");
    imagegif($eyes);
    imagecolordeallocate( $text_color );
    imagedestroy( $eyes );
    exit();
    }else{
    $in = mysql_fetch_array(mysql_query("SELECT level, name, sex FROM ibwf_tamagotchi WHERE id='".$pid."'"));

    if(
    $in[0]=='1'||$in[0]<5)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/2.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "38";
    $a = "21";
    $b = "48";
    }else{
    $pet = "imgpet/1.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "23";
    $y = "38";
    $a = "23";
    $b = "48";
    }
    }else if(
    $in[0]=='5'||$in[0]<10)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/3.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "45";
    $a = "21";
    $b = "55";
    }else{
    $pet = "imgpet/3.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "45";
    $a = "21";
    $b = "55";
    }
    }else if(
    $in[0]=='10'||$in[0]<15)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/4.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "50";
    $a = "21";
    $b = "60";
    }else{
    $pet = "imgpet/4.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "50";
    $a = "21";
    $b = "60";
    }
    }else if(
    $in[0]=='15'||$in[0]<20)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/5.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "50";
    $a = "21";
    $b = "60";
    }else{
    $pet = "imgpet/5.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "50";
    $a = "21";
    $b = "60";
    }
    }else if(
    $in[0]=='20'||$in[0]<25)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/6.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "58";
    $a = "21";
    $b = "68";
    }else{
    $pet = "imgpet/7.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "60";
    $a = "21";
    $b = "70";
    }
    }else if(
    $in[0]=='25'||$in[0]<30)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/9.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "53";
    $a = "21";
    $b = "63";
    }else{
    $pet = "imgpet/8.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "55";
    $a = "21";
    $b = "65";
    }
    }else if(
    $in[0]=='30'||$in[0]<35)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/11.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "53";
    $a = "21";
    $b = "63";
    }else{
    $pet = "imgpet/10.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "55";
    $a = "21";
    $b = "65";
    }
    }else if(
    $in[0]=='35'||$in[0]<40)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/13.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "58";
    $a = "21";
    $b = "68";
    }else{
    $pet = "imgpet/12.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "60";
    $a = "21";
    $b = "70";
    }
    }else if(
    $in[0]=='40'||$in[0]<45)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/15.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "58";
    $a = "21";
    $b = "68";
    }else{
    $pet = "imgpet/14.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "55";
    $a = "21";
    $b = "65";
    }
    }else if(
    $in[0]=='45'||$in[0]<50)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/17.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "53";
    $a = "21";
    $b = "63";
    }else{
    $pet = "imgpet/16.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "50";
    $a = "21";
    $b = "60";
    }
    }else if(
    $in[0]=='50'||$in[0]<55)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/19.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "53";
    $a = "21";
    $b = "63";
    }else{
    $pet = "imgpet/18.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "50";
    $a = "21";
    $b = "60";
    }
    }else if(
    $in[0]=='55'||$in[0]<100)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/21.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "53";
    $a = "21";
    $b = "63";
    }else{
    $pet = "imgpet/20.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "55";
    $a = "21";
    $b = "65";
    }
    }else if(
    $in[0]=='100'||$in[0]>100)
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/23.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "15";
    $y = "60";
    $a = "15";
    $b = "70";
    }else{
    $pet = "imgpet/22.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "15";
    $y = "55";
    $a = "15";
    $b = "65";
    }
    }else if(
    $in[0]=='0')
    {
    if(
    $in[2]=='F')
    {
    $pet = "imgpet/2.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "21";
    $y = "38";
    $a = "21";
    $b = "48";
    }else{
    $pet = "imgpet/1.gif";
    $msg = "Level: $in[0]";
    $name = $in[1];
    $size = "2";
    $x = "23";
    $y = "38";
    $a = "23";
    $b = "48";
    }
    }else{
    $pet = "imgpet/no.gif";
    $msg = "Missing Pet!";
    $name = "No Name!";
    $size = "2";
    $x = "10";
    $y = "30";
    $a = "22";
    $b = "41";
    }
    $eyes = imagecreatefromgif($pet);
    $text_colour = imagecolorallocate( $eyes, 0, 0, 0 );
    imagestring( $eyes, $size, $x, $y, $msg, $text_colour );
    imagestring( $eyes, $size, $a, $b, $name, $text_colour );
    header("Content-type: image/gif");
    imagegif($eyes);
    imagecolordeallocate( $text_color );
    imagedestroy( $eyes );
    }
    ?>

  4. #4
    Guest

    Predefinito

    La cartella imgpet s trova nella stessa directory del file php?

    Sposta l'header all'inizio della condizione, cioè prima di:
    Codice PHP:
    $eyes = imagecreatefromgif($pet);

  5. #5
    Guest

    Predefinito

    biccheddu grazie ora si vede

    edit:

    Ciao ho un altro problema. l'immagine non si vede
    Codice PHP:
    <b> Immagine:</b>
    </center>
    <hr>
    Indirizzo dell'Immagine:<br>
    <?
    echo "<form><input type=\"text\" name=\"clock\" value=\"pic.php?action=$action&text=$text&X=$X&Y=$Y&font=$font&R=$R&G=$G&B=$B&pict=$pict\"></form>";
    echo
    " Esempio:<br><img src=\"../pic.php?action=$action&text=$text&X=$X&Y=$Y&font=$font&R=$R&G=$G&B=$B&pict=$pict\" alt=\"clock\">";
    ?>
    pic.php
    Codice PHP:
    <?php
    if (
    isset(
    $_GET['pict'])
    and
    $_GET['pict']=='green'
    or $_GET['pict']=='red'
    or $_GET['pict']=='blue'
    or $_GET['pict']=='violet'
    or $_GET['pict']=='yellow'
    ){
    $funci="imagecreatefromjpeg";
    $im = @$funci("img/".$pict.".JPG");
    $color = ImagecolorAllocate($im,$R,$G,$B);
    ImageString ($im, $font, $X, $Y,"$text",$color);
    @
    header("Content-type: image/gif");
    @
    imagegif($im);
    }
    else
    {
    header("Location: index.php");
    }
    ?>
    dove sbaglio?
    Ultima modifica di dreadnaut : 06-06-2011 alle ore 14.21.48 Motivo: usa il tasto Edita --->

  6. #6
    Guest

    Predefinito

    Manca una buona parte del codice! Non vengono valorizzate tante variabili, quali: $pict, $R, $G, $B, $text, $color, $font.

    Dovresti postarlo completo o cercare un altro codice.

  7. #7
    Guest

    Predefinito

    allora cercherò un altro codice più completo, grazie biccheddu

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •