Hier mal das komplette Teil. Da ist noch der alte Code für das Bilder-Verkleinern drin, welcher aber nicht funktioniert.
PHP-Code:
<!--
var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
win.focus();}
// -->
</script>
<?
require("./inc/config.inc.php");
echo<<<EOT
<img src="./images/image.png" align="absmiddle"> <b>Image Upload</b><br>
<br><font size="-1">Upload an Image (max. $maxxx kb - Allowed: *jpg *gif)</font>
<form action="?p=1&act=1_up" method="POST" enctype="multipart/form-data" id="form" method="post" onsubmit="a=document.getElementById('form').style;a.display='none';b=document.getElementById('part2').style;b.display='inline';" style="display: inline;">
<input type="file" name="image" size="45">
<input type="submit" name="sent" class="input" value=" Upload! "><br>
<input type=checkbox name='agb' value="ok"><font size="-1"><a href="javascript:NewWindow('agb.php','mypopup','450','500','custom','front');">AGBs</a> accepted?!?</font></form><br>
<br><script src='http://www.ads4webbis.de/codes/random_bannerview.php?id=947&aid=2352&trackid='></script>
<div id="part2" style="display: none;">
<script language="javascript" src="./js/xp_progress.js"></script>
Bild wird hochgeladen. Bitte warten...
<BR><BR>
<script type="text/javascript">
var bar1= createBar(300,15,'white',1,'black','blue',85,7,3,"");</script>
</div>
<br><br>
EOT;
$userverz = "./pics";
if($_POST['sent'])
{
$name23=uniqid('uploads_'); // Bild umbenennen
if($_FILES[image][size]>$maxxx)
{$fehler ="<br>File is too big...<br>";}
if(!($_FILES[image][type] == 'image/jpeg' OR $_FILES[image][type] == 'image/gif'))
{$fehler.="<br>Wrong Type<br>"; }
if(!($HTTP_POST_VARS['agb']=="ok"))
{$fehler.="You must accept the rules!!<br>"; }
if(!$fehler)
{
switch($_FILES[image][type])
{
case 'image/jpeg';
$name = "$name23.jpg";
break;
case 'image/gif';
$name = "$name23.gif";
break;
}
$name = $userverz."/".$name;
$filename = "pics/uploads_4d71f64d7df09.jpg";
$percent = 0.5;
// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// Output
imagejpeg($thumb,"a.jpg");
//------------------------------ HTML SEITE ERSTELLEN ---------------------------
copy($_FILES[image][tmp_name], $name);
$dateihandle = fopen("$name.html","w");
fwrite($dateihandle, "
<title>$name_der_Seite</title>
<style type=\"text/css\">
<!--
a:link {color: #708090; text-decoration: None; font-family:Verdana; font-size:12px;}
a:visited {color: #708090; text-decoration: None; font-family:Verdana; font-size:12px;}
a:active {color: #708090; text-decoration: None; font-family:Verdana; font-size:12px;}
a:hover {color: #0000CC; text-decoration: None; font-family:Verdana; font-size:12px;}
-->
</style>
<script type=\"text/javascript\" src=\"http://view.advert-layer.de/ad1_1568.js\"></script>
<Body leftmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">
<TABLE ID=\"Tabelle13\" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=\"100%\">
<TR HEIGHT=1>
<TD ALIGN=CENTER>
<P><FONT FACE=\"Arial,Helvetica,Geneva,Sans-serif,sans-serif\">
<a href=\"www.best-ptc.de/upload/\"><IMG SRC=\"http://www.best-ptc.de/upload/images/logo2.png\" VSPACE=0 HSPACE=0 ALIGN=\"TOP\" BORDER=0 ALT=\"best-ptc.de Picture Upload\" TITLE=\"best-ptc.de Picture Upload\"></a></FONT></TD>
</TR>
</TABLE>
<center><br><img src='$scriptsource/$name' border=0><br><br>
<font color=\"#A0A0A0\" FACE=\"Verdana\" size=\"-1\">©2008 $copyright</font><br>
</center>
");
fclose($dateihandle);
//------------------------------ THIMBNAIL ERSTELLEN ---------------------------
$bildname = str_replace("./pics/","$name");
$PicPathIn="$userverz/";
$PicPathOut="$userverz/pics/";
// Orginalbild
$bild="$bildname";
// Bilddaten ermitteln
$size= GetImageSize("$PicPathIn"."$bild");
$breite=$size[0];
$hoehe=$size[1];
$neueBreite=50;
$neueHoehe= intval($hoehe*$neueBreite/$breite);
if($size[2]==1) {
// GIF
$altesBild= imagecreatefromgif("$PicPathIn"."$bild");
$neuesBild=imagecreatetruecolor($neueBreite,$neueHoehe);
imagecopyresampled($neuesBild,$altesBild,0,0,0,0,$neueBreite,$neueHoehe,$breite,$hoehe);
imageGIF($neuesBild,"$PicPathOut"."thumb_"."$bild");
}
if($size[2]==2) {
// JPG
$altesBild= ImageCreateFromJPEG("$PicPathIn"."$bild");
$neuesBild=imagecreatetruecolor($neueBreite,$neueHoehe);
imagecopyresampled($neuesBild,$altesBild,0,0,0,0,$neueBreite,$neueHoehe,$breite,$hoehe);
ImageJPEG($neuesBild,"$PicPathOut"."thumb_"."$bild");
}
if($size[2]==3) {
// PNG
$altesBild= ImageCreateFromPNG("$PicPathIn"."$bild");
$neuesBild=imagecreatetruecolor($neueBreite,$neueHoehe);
imagecopyresampled($neuesBild,$altesBild,0,0,0,0,$neueBreite,$neueHoehe,$breite,$hoehe);
ImagePNG($neuesBild,"$PicPathOut"."thumb_"."$bild");
}
$Thumbnail=$PicPathOut."thumb_".$bild;
$filename = "pics/uploads_4d71d14d25851.jpg";
$percent = 0.5;
// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// Output
imagejpeg($thumb,"a.jpg");
//---------------------- IN DER DB SPEICHERN -----------------------------------
$name2 = $scriptsource."/".$name;
$name2 = str_replace("./","",$name2);
$urlbild = "$name2.html";
$Thumbnail2 = str_replace("./","",$Thumbnail);
$thumb = $scriptsource."/".$Thumbnail2;
$thumb2 = "<a href=\"$urlbild\" target=\"_blank\" ><img src=\"$thumb\" border=0></a> ";
$bbcode = '[url='.$urlbild.'][img]'.$name2.'[/img][/url]'; //Ohne Thumbnail
$bbcode2 = '[url='.$urlbild.'][img]'.$thumb.'[/img][/url]'; //mit Thumbnail
$timestamp = time();
$datum = date("d.m.Y",$timestamp);
$uhrzeit = date("H:i",$timestamp);
$datum2 = $datum ." - ". $uhrzeit . "";
$link = $name2;
$del = rand(0,99999);
$ip = $_SERVER['REMOTE_ADDR'];
$insert = "INSERT INTO `img` (`link`,`code`,`del`,`datum`,`ip`)
VALUES ('" . $link . "','" . $name . "','" . $del . "','" . $datum2 . "','" . $ip . "')";
$insert2 = mysql_query($insert);
}
else
{
echo "<font color=red>". $fehler . "</font>";
}
}
//------------------------------------- Codes des bildes nach upload------------
if ($_GET['act']) $step = $_GET['act'];
if($step=="1_up")
{
if(!$fehler)
{
echo "
</br>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=4 WIDTH=100% >
<TR>
<TD align=center VALIGN=TOP width='100' rowspan=12 bgcolor=''><font size='-1' class='text1'>Thumbnail</font><br><br>
<img src='$name2' border='0' width='300'>
</TD>
<TD align=center width='50' valign=bottom bgcolor=''>
<font size='-1'><b>Dein Bild:</b></FONT>
</TD>
</TR>
<TR>
<TD align=center width='100' valign=top bgcolor=''>
<input type='text' class='text_bgImage' value='$urlbild'>
</TD>
</TR>
<TR>
<TD align=center width='50' valign=bottom bgcolor=''>
<font size='-1'><b>Thumbnail</b></FONT>
</TD>
</TR>
<TR>
<TD align=center width='100' valign=top bgcolor=''>
<input type='text' class='text_bgImage' value='$name2'>
</TD>
</TR>
<TR>
<TD align=center width='50' valign=bottom bgcolor=''>
<font size='-1'><b>Direktlink</b></FONT>
</TD>
</TR>
<TR>
<TD align=center width='100' valign=top bgcolor=''>
<input type='text' class='text_bgImage' value='$name2'>
</TD>
</TR>
<TR>
<TD align=center width='100' valign=bottom bgcolor=''>
<font size='-1'><b>Direktlink mit Thumbnail (HTML)</b></FONT>
</TD>
<TR>
<TD align=center width='100' valign=top bgcolor=''>
<input type='text' class='text_bgImage' value='$thumb2'>
</TD>
</TR>
<TR>
<TD align=center width='100' valign=bottom bgcolor=''>
<font size='-1'><b>BBCode ohne Thumbnail</b></FONT>
</TD>
<TR>
<TD align=center width='100' valign=top bgcolor=''>
<input type='text' class='text_bgImage' value='$bbcode'>
</TD>
</TR>
<TR>
<TD align=center width='100' valign=bottom bgcolor=''>
<font size='-1'><b>BBCode mit Thumbnail</b></FONT>
</TD>
<TR>
<TD align=center width='100' valign=top bgcolor=''>
<input type='text' class='text_bgImage' value='$bbcode2'>
</TD>
</TR>
</TABLE>";
}
else
{
echo"";
}
}
?>