как да слага моя картина

shaxaaa

Registered
Как да направя така че ако не му се подаде снимка да слага моя после , защото сега изкарва че неможе да намери снимката . А искам например да пише на нея "Няма снимка" и да изкарва това.
Код:
<?php 

//connect to the database
$link = mysql_connect("localhost", "root", "")
  or die("Could not connect: " . mysql_error());
mysql_select_db("reklama", $link) 
  or die (mysql_error());

//make variables available 
$advert_message = $_POST['advert_message'];
$advert_user = $_POST['advert_user'];
$image_tempname = $_FILES['image_filename']['name'];
$advert_type = $_POST['advert_type'];
$advert_agree = $_POST['advert_agree'];
$today = date("Y-m-d h:m:s");

//upload image and check for image type
$ImageDir ="C:/Program Files/apachefriends/xampp/htdocs/reklama/images/";


$ImageThumb = $ImageDir . "thumbs/";

$ImageName = $ImageDir . $image_tempname;

if (move_uploaded_file($_FILES['image_filename']['tmp_name'], 
                      $ImageName)) {

  //get info about the image being uploaded
  list($width, $height, $type, $attr) = getimagesize($ImageName);

  if ($type > 3) {
    echo "Sorry, but the file you uploaded was not a GIF, JPG, or " .
         "PNG file.<br>";
    echo "Please hit your browser's 'back' button and try again.";
	} else {
   //image is acceptable; ok to proceed

  //insert info into image table
  $advert_message = trim($_POST['advert_message']);
  if(empty($advert_message)) { $error .= "Please+enter+an+advert+message%21%0D%0A"; }
  if(empty($_POST['advert_user']))  { $error .="Please+enter+an+advert+username%21%0D%0A"; }
  if(empty($_POST['advert_type'])) { $error .="Please+enter+an+advert+type%21%0D%0A"; }
  if(empty($_POST['advert_agree'])) { $error .="Please+agree+with+the+advert%21%0D%0A"; }
  if (empty($error)) {
  $insert = "INSERT INTO advert_post
            (advert_id, advert_message, advert_user, advert_date, advert_type, advert_agree)
            VALUES
            (NULL, '$advert_message', '$advert_user', '$today', '$advert_type', 'advert_agree')";
			} else {
			header("location:pusni_obqva.php?action=add&error=" . $error);
			}
			if (isset($insert) && !empty($insert)) {
			echo "<!--" .$insert. "--!>";
			?>
			<?php
		    }
  $insertresults = mysql_query($insert)
    or die(mysql_error());

  $lastpicid = mysql_insert_id();

  //change the following line:
  $newfilename =  $ImageDir . $lastpicid . ".jpg";

  if ($type == 2) {
    rename($ImageName, $newfilename);
  } else {
    if ($type == 1) {
      $image_old = imagecreatefromgif($ImageName);
    } elseif ($type == 3) {
      $image_old = imagecreatefrompng($ImageName);
    }

    //"convert" the image to jpg
    $image_jpg = imagecreatetruecolor($width, $height);
    imagecopyresampled($image_jpg, $image_old, 0, 0, 0, 0, 
                     $width, $height, $width, $height);
    imagejpeg($image_jpg, $newfilename);
    imagedestroy($image_old);
    imagedestroy($image_jpg);
  }

  $newthumbname = $ImageThumb . $lastpicid . ".jpg";

  //get the dimensions for the thumbnail
  $thumb_width = 100;
  $thumb_height = 75;

  //create the thumbnail
  $largeimage = imagecreatefromjpeg($newfilename);
  $thumb = imagecreatetruecolor($thumb_width, $thumb_height);
  imagecopyresampled($thumb, $largeimage, 0, 0, 0, 0, 
                    $thumb_width, $thumb_height, $width, $height);
  imagejpeg($thumb, $newthumbname);
  imagedestroy($largeimage);
  imagedestroy($thumb);
  
  $url = "location: showadvert.php?id=" . $lastpicid;
  header($url);
}
}
?>
Еми представи се че имаш ъплоуд система от там можеш да качваш снимки , ако качиш тя ще излезе някъде в сайта но ако некачиш ще излезе че няма изображение , а искам вместо да няма изображение да слага някакво мое например бял фон със надпис "Няма снимка"

никой ли неможе да помогне поне малко
 

Горе