$max_size) { echo "File Size too Big!
\n"; exit; } if (($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/png") || ($HTTP_POST_FILES['userfile']['type']=="image/tiff")) { if (file_exists("./".$path . $HTTP_POST_FILES['userfile']['name'])) { echo "A File with that name exists, please rename your file.
\n"; exit; } //Start DB Transaction $db_query = mysql_connect($db_host, $db_user, $db_password) or die('Could not connect: ' . mysql_error()); mysql_select_db('mkzip_image') or die('Could not select database'); //generate random number $zufall = rand(123,999999); $fupl = "$zufall"; //Copy the real image to "IMAGES" directory as defined in config file $res = copy($HTTP_POST_FILES['userfile']['tmp_name'], "./".$path .$fupl .$HTTP_POST_FILES['userfile']['name']); if (!$res) { echo "Upload Failed, please try again
\n"; exit; } else { //set url variable $domst = ""; $drecks = "/"; $original_name = $HTTP_POST_FILES['userfile']['name']; $actual_date = date("Y\-m\-d"); $imgf = $fupl.$HTTP_POST_FILES['userfile']['name']; $thbf = $tpath.$imgf; $urlf = $domst .$domain .$drecks .$path .$imgf; //Insert image data into DB $result = mysql_query("INSERT INTO files (file_name,file_name_final,file_path,thumb_path,upload_date,last_hit_date,hits) VALUES ('$original_name','$imgf','$path$imgf','$tpath.$thbf','$actual_date','$actual_date','0')"); if (!$result) { die('Invalid query: ' . mysql_error()); } //ImageMagick based routines to create thumbnails function makethumb($origimage,$resizedimage,$thumbtype,$size) { global $original_name; switch ($thumbtype) { case "polaroid": exec("convert -size 400x400 -caption '{$original_name}' $origimage -resize '{$size}x{$size}>' -font Ravie -gravity center -background gray20 -polaroid 0 -quality 50 -depth 8 $resizedimage"); break; case "standard": exec("convert -size 400x400 -caption '{$original_name}' $origimage -resize '{$size}x{$size}>' -font Ravie -quality 50 -depth 8 $resizedimage"); break; } } // CALL MAKETHUMB FUNCTION TO GENERATE THUMBNAILS $t_size = $_POST['thumb_size']; $t_type = $_POST['thumb_type']; makethumb($path.$imgf,$tpath.$imgf,$t_type,$t_size); //Close DB Connection mysql_close($db_query); header("Location: getlinks_".$imgf.".htm"); exit; } } else { echo "Sorry we dont allow that file type.!
\n"; exit; } } ?>