problema incomprensibile con upload immagini

Ciao a tutti, io ho un file (carphoto.php) che dovrebbe far fare l'upload in una cartella specifica ed infatti lo fa solo che poi da quella cartella specifica dovrebbe far posizionare la foto dove decido io di stamparla!! ed invece non lo fa! fra l'altro quando eseguo la pagina rimane tutto bianco e non mi da nessun errore solo che rimane bianco..... posto il codice

<?php

session_start();
include_once("config.php");
include_once("session.php");
include_once("nav.php");
if(!VerifySession()){
header("location:login.php");
}

$hidaction=getVal('do');
$cid=getVal(cid);
$image_id=getVal(image_id);

eval("\$display = \"".$Template->GetTemplate("leftside")."\";");
$CarInfo->sortby = $sortbyvar;

$CarInfo->cid=$cid;

$CarInfo->cLoad();
if ($CarInfo->owner_id != $_SESSION['oid']){
  $Message = "<span style=\"color:red; font-weight:bold\"><br />$NoPermissions<br /></span>\n";
  eval("\$display .= \"".$Template->GetTemplate("error_msg_close")."\";");
  eval("\$footer = \"".$Template->GetTemplate("footer")."\";");
  eval("\$main = \"".$Template->GetTemplate("main")."\";");
  $Template->ProcessTemplate($main);
  exit;
}
$CarInfo->Load();
if($hidaction=="addphoto")
{
$ctrP=0;
  foreach($_FILES['pics'] as $pics)
{
if($_FILES['pics']['name'][$ctrP]<>"")
{
if(is_uploaded_file($_FILES['pics']['tmp_name'][$ctrP]) or die("No Image: ".$_FILES['pics']['name'][$ctrP]))
{
$ext = substr(strrchr($_FILES['pics']['name'][$ctrP],"."),1);
        //$pieces = explode(".", $_FILES['pics']['name'][$ctrP]);
//$ext = $pieces[count($pieces) - 1];
if ((in_array($ext, $types_array)) AND ($_FILES['pics']["size"][$ctrP]<(MAXFILE_SIZE * 1000)))
{
$orgImageName="cid".$property_id."_".str_replace(" ","_",$_FILES['pics']['name'][$ctrP]);
$thmImageName="thumb_cid".$property_id."_".str_replace(" ","_",$_FILES['pics']['name'][$ctrP]);
$dtlImageName="dtl_cid".$property_id."_".str_replace(" ","_",$_FILES['pics']['name'][$ctrP]);

if(move_uploaded_file($_FILES['pics']['tmp_name'][$ctrP],NEWPICPATH."/".$orgImageName) or die("error on moving"))
{
# Get image location
$image_path = NEWPICPATH."/".$orgImageName;
//echo $image_path;
# Load image
$img = null;
$main_img=null;
$thumb_img=null;
$dtl_img=null;

            $size = @getimagesize($image_path);
            $scale = min(MAXIMAGE_W_SIZE/$size[0], MAXIMAGE_H_SIZE/$size[1]);
        
            # If the image is larger than the max shrink it

            if($scale<1) {
             $i = .9;
             do {
               $dtlW = floor($i*$size[0]);
               $dtlH = floor($i*$size[1]);
               $i = $i - .05;
              } while ($dtlW >= MAXIMAGE_W_SIZE);


            } else {
             $dtlW = $size[0];
              $dtlH = $size[1];
            }
      
            $i = 0;
             do {
               $thumbW = floor($i*$size[0]);
               $thumbH = floor($i*$size[1]);
               $i = $i + .05;
              } while ($thumbW <= LOWESTIMAGE_W_SIZE);
              

            $ext = strtolower(end(explode('.', $image_path)));
if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'pjpeg') {
$img = @imagecreatefromjpeg($image_path);
} else if ($ext == 'png') {
$img = @imagecreatefrompng($image_path);
# Only if your version of GD includes GIF support 
} else if ($ext == 'gif') {
$img = @imagecreatefromgif($image_path);
}

# If an image was successfully loaded, test the image for size
if ($img) {
# Get image size and scale ratio
$width = imagesx($img);
$height = imagesy($img);
# Create a new temporary image
$thumb_img = imagecreatetruecolor($thumbW, $thumbH);
$dtl_img = imagecreatetruecolor($dtlW, $dtlH);
# Copy and resize old image into new image
ImageCopyResampled($thumb_img, $img, 0, 0, 0, 0,$thumbW, $thumbH, $width, $height);
ImageCopyResampled($dtl_img, $img, 0, 0, 0, 0,$dtlW, $dtlH, $width, $height);
# Copy and resize old image into new image
imagedestroy($img);
} //end of if $img

# Display the image
if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'pjpeg') {
imagejpeg($thumb_img,THUMBPICPATH."/".$thmImageName);
  imagejpeg($dtl_img,DTLPICPATH."/".$dtlImageName);
} else if ($ext == 'png') {
imagepng($thumb_img,THUMBPICPATH."/".$thmImageName);
  imagepng($dtl_img,DTLPICPATH."/".$dtlImageName);
# Only if your version of GD includes GIF support
} else if ($ext == 'gif') {
imagegif($thumb_img,THUMBPICPATH."/".$thmImageName);
  imagegif($dtl_img,DTLPICPATH."/".$dtlImageName);
}

imagedestroy($thumb_img);
imagedestroy($dtl_img);
//insert into db
$CarInfo->cid=$cid;
$CarInfo->image_path=$orgImageName;
$CarInfo->InsertImage();
//
} //end of if moveuploaded file 
} // end of if in_array
else {
        $error .= "Invalid image: {$_FILES['pics']['name'][$ctrP]}<br />";
        }
} //end of if is_uploaded_file
else {
        $error .= "No image: {$_FILES['pics']['name'][$ctrP]}<br />";
        }
} // end of if pics name is not empty string
$ctrP++;
} //end of for each

if (!$error){
    $display .="<META HTTP-EQUIV=\"Refresh\" Content=\"1;URL=carphoto.php?cid=$cid\">";
    eval("\$footer = \"".$Template->GetTemplate("footer")."\";");
    eval("\$main = \"".$Template->GetTemplate("main")."\";");
    $Template->ProcessTemplate($main);
    exit;
  } else {
    $hidaction=="add";
  }
}

if($hidaction=="delete"){
$CarInfo->cid=$cid;
$CarInfo->image_id=$image_id;
$CarInfo->DeletePhoto();
$error = $CarInfo->msg;
}

if($hidaction=="add"){

  for($i=0;$i<5;$i++){
    $imagerow .=<<<PHOTO
       <tr>
        <td style="height:33px"><input type="file" name="pics[]" size="70" class="tinput" /></td>
       </tr>
PHOTO;
    }

  if ($CarInfo->listed_by == 'S'){
  $HeaderImage = "<img src=\"images/title_seller-editcarimg.gif\" width=\"210\" height=\"14\" alt=\"\" title=\"\" />";
} elseif ($CarInfo->listed_by == 'D'){
  $HeaderImage = "<img src=\"images/title_dealer-editcarimg.gif\" width=\"210\" height=\"14\" alt=\"\" title=\"\" />";
}
  eval("\$display .= \"".$Template->GetTemplate("carimageform")."\";");
  eval("\$footer = \"".$Template->GetTemplate("footer")."\";");
  eval("\$main = \"".$Template->GetTemplate("main")."\";");
  $Template->ProcessTemplate($main);
  exit;
}

// default listing below
$Navi =& new PageNation();

  $Navi->Ofs = $_GET["ofs"];
  $Navi->Pgx = $pagenum;
  $Navi->PerPg = $listings_per_page;
  if ($CarInfo->NumRows){
    $Navi->AllLinks = $CarInfo->NumRows;
    $Navi->AdminPaging();
  }
$CarInfo->Limit=$limit;
$CarInfo->offset=$offset;
$CarInfo->ListPhotos();


$res=$CarInfo->result;
$numrows=$CarInfo->NumRows;

if ($CarInfo->listed_by == 'S'){
  $HeaderImage = "<img src=\"images/title_seller-currentcarimg.gif\" width=\"210\" height=\"14\" alt=\"\" title=\"\" />";
} elseif ($CarInfo->listed_by == 'D'){
  $HeaderImage = "<img src=\"images/title_dealer-currentcarimg.gif\" width=\"210\" height=\"14\" alt=\"\" title=\"\" />";
}


if($CarInfo->NumRows){
if($res != ""){
$str=explode(",",$res);
$cnt=0;
$end=count($str);

for($i=0; $i<$end; $i++){
$image_id=$str[$i];
$CarInfo->image_id=$str[$i];
$CarInfo->LoadPhoto();
$image_path=$CarInfo->image_path;
$thumb_image=$CarInfo->thumb_image;
$filepath=THUMBPICURL."/".$thumb_image; //image path for the thumbnail
//echo NEWPICPATH."/".$image_path;
      if(file_exists(NEWPICPATH."/".$image_path)){ //get the height,width of the original pic
list($width, $height, $type, $attr) = getimagesize(NEWPICPATH."/".$image_path);
}

      if ( file_exists(THUMBPICPATH."/".$thumb_image) ){
        $width = $width + 30;
        $height =$height + 30;
        $Image = "<a href=\"javascript:openWindow('popup.php?photo_name=$image_path', '$width', '$height');\">";
        $Image .= "<img src=\"$filepath\"></a>\n";
      }else{
        $Image = "<span class=\"txt_content03\">$ImageNotAvailable</span>\n";
      }
      eval("\$photo_listing .= \"".$Template->GetTemplate("carphoto_middle")."\";");

    }

  }

} //end of numrows

eval("\$display .= \"".$Template->GetTemplate("carimagelist")."\";");
eval("\$footer = \"".$Template->GetTemplate("footer")."\";");
eval("\$main = \"".$Template->GetTemplate("main")."\";");
$Template->ProcessTemplate($main);
?>
inviato 8 anni fa
jappoz
X 0 X
Effettua l'accesso o registrati per rispondere a questa domanda