static function wytnij($zrodlowy, $docelowy, $newX, $newY) { if (!file_exists($zrodlowy)) { Strona::blad('Brak pliku: ' . $zrodlowy); return 1; } $return = 0; if ($img = @imagecreatefromjpeg($zrodlowy)) { $oldX = imagesX($img); $oldY = imagesY($img); if ($newX == 0) { $newX = $oldX; } if ($newY == 0) { $newY = $oldY; } $im = @imagecreatetruecolor($newX, $newY); if (!@imagecopy($im, $img, 0, 0, 0, 0, $newX, $newY)) { Strona::blad('Błąd imagecopyresized() ' . $zrodlowy); } else { @imagejpeg($im, $docelowy, 120); $return = 0; } } else { Strona::blad('Błąd imagecreatefromjpeg() ' . $zrodlowy); } return $return; }
<?php include 'strona.inc'; $strona = new Strona(); $strona->naglowek = "baner_glowny"; $strona->zawartosc = "To jest główna."; $strona->wyswietlStrone(); unset($strona);