laduj.php
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <?php include ("upload.php"); $image = new Image($_FILES['file']['name']); $image -> PicDir = "uploads/"; $image -> TmpName = $_FILES['file']['tmp_name']; $image -> newHeight = '100'; $image -> newWidth = '100'; //$image -> Save(); //use this if you wish images without resizing $image -> Resize (); } else { ?><?php } ?> <form name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> <input type="file" name="file" size="40"> <input type="submit" name="submit" value="dodaj"> </form>
Sam nie pisałem tych skryptów dlatego mam z tym problem.. Więc stąd moje pytania.. po to jest
w 1 pliku ?
<?php } ?>
Dlaczego obrazek nie zawsze się pojawia ?
Dlaczego znowu wyskakuje po załadowaniu zdjęcia i wyświetleniu informacji pasek ładowania obrazka na samym dole ?
Jak podnieść infomację o załadowanym obrazku do góry ?
Wiem, że sporo tego ale z góry dzięki !

I drugi skrypt..
i upload.php
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <?php class Image { var $FileName; var $FileSize; var $FileType; var $newWidth; // new width var $newHeight; //new height var $TmpName; var $PicDir; //store uploaded images var $MaxFileSize = 500000; //kbytes var $ImageQuality = 75; // image compression (max value 100) function GetInfo() { $out=' <br><br>Zdjęcie zostało dodane!<br> Name: '.$this->FileName.'<br> file size: '.$this->FileSize.' byte<br> file type: '.$this->FileType.'<br> return $out; } function Image($FileName) { $this->FileName=$FileName; } function GetFileExtention ($FileName) { return true; } else { return false; } } function ExistFile () { $fileexist = $_SERVER['DOCUMENT_ROOT'] . '/' . $this->PicDir . $this->FileName; } function GetError ($error) { switch ($error) { case 0 : echo "Złe rozszerzenie pliku <b>$this->FileType</b>! Dopuszczalne typy: .jpg, .jpeg, .gif, .png <b>$this->FileName</b><br>"; break; case 1 : break; case 2 : break; case 3 : break; } } function Resize () { else { // Get new sizes $ratio_orig = $width_orig/$height_orig; if ($this->newWidth/$this->newHeight > $ratio_orig) { $this->newWidth = $this->newHeight*$ratio_orig; } else { $this->newHeight = $this->newWidth/$ratio_orig; } $normal = imagecreatetruecolor($this->newWidth, $this->newHeight); if ($ext == "jpg") { $source = imagecreatefromjpeg($this->TmpName); } else if ($ext == "gif") { $source = imagecreatefromgif ($this->TmpName); } else if ($ext == "png") { $source = imagecreatefrompng ($this->TmpName); } imagecopyresampled($normal, $source, 0, 0, 0, 0, $this->newWidth, $this->newHeight, $width_orig, $height_orig); if ($ext == "jpg") { //ob_start(); imagejpeg($normal, "$this->PicDir/$this->FileName", "$this->ImageQuality"); //$binaryThumbnail = ob_get_contents(); //ob_end_clean(); } else if ($ext == "gif") { imagegif ($normal, '', "$this->ImageQuality"); } else if ($ext == "png") { imagepng ($normal, '', "$this->ImageQuality"); } imagedestroy($source); } } function Save() { else { } } } ?>