i chce wrzucić do niego skrypt wrzucający znak wodny probowałem wiele razy i ciągle jakieś błedy
Pod plikiem dodaj umieściłem skrypt znaku wodnego pomozcie.
<?php /* Projekt: shitIMGv2 * Plik: dodaj.php * Data modyfikacji: 01-08-2011 * * Copyright (C) 2011 Paweł Klockiewicz & Wojciech Król * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ require_once('connect.php'); require_once('functions.php'); ?> <html> <head> <?php include('tpl/head.php') ?> </head> <body> <div id="naglowek"> <!-- code by klocek & Quik --> <?php include('tpl/naglowek.php') ?> </div> <div id="menu"> <?php include('tpl/menu.php') ?> </div> <div id="kontener"> <?php { { if(!$_POST['tytul'] || !$_FILES['obrazek']['name']) { echo '<b>Nie wypełniono pola z tytułem lub obrazkiem!</b><br/><a href="dodaj.php">« Powrót</a>'; } else { //UPLOAD OBRAZKA if($sp1[1] == "gif" or $sp1[1] == "jpg" or $sp1[1] == "JPG" or $sp1[1] == "GIF" or $sp1[1] == "jpeg" or $sp1[1] == "JPEG" or $sp1[1] == "png" or $sp1[1] == "PNG") { $uploaddir = 'img/upload/'.$data_img.'-'; $_FILES['obrazek']['name'] = przyjazny_string($_FILES['obrazek']['name']); { //Zmiana rodzielczości obrazka if($sp1[1] != "gif" AND $sp1[1]!= "GIF") { $image = new SimpleImage(); $image->load($uploaddir.$_FILES['obrazek']['name']); if($image->getWidth() > 670) { $image->resizeToWidth(670); $image->save($uploaddir.$_FILES['obrazek']['name']); } else { //Zmiana wielkości do tego samego rozmiaru ale z kompresją $image->resizeToWidth($image->getWidth()); $image->save($uploaddir.$_FILES['obrazek']['name']); } } ////////////////////////////// $obrazek='img/upload/'.$data_img.'-'.$_FILES['obrazek']['name']; $autor=$_SESSION['login']; $zapytanie = "INSERT INTO `shity` (`id`, `tytul`, `obrazek`, `zrodlo`, `autor`, `data`, `typ`) VALUES ('', '$tytul', '$obrazek', '$zrodlo', '$autor', '$data', 'obrazek')"; echo '<b>Obrazek został pomyślnie dodany!</b><br/> <a href="index.php">« Strona Główna</a>'; } else { } } else { echo '<b>Nie wybrano żadnego obrazka bądź jego format jest niedozwolony!</b><br/><a href="dodaj.php">« Powrót</a>'; } //KONIEC UPLOAD OBRAZKA } } else { ?> <?php if($_GET['co']=='obrazek' || !$_GET['co']) { ?> <div id="tab"> <ul> <li id="selected"><a href="dodaj.php?co=obrazek"><img src="img/photo.png" style="position:relative;top:3px;"/> Dodaj Obrazek</a></li> <li><a href="dodaj.php?co=film"><img src="img/film.png" style="position:relative;top:3px;"/> Dodaj filmik z YouTube</a></li> </ul> </div> <div id="tab_linia"></div> <form action="dodaj.php?co=obrazek" method="post" enctype="multipart/form-data"> <table> <colgroup> <col width="120px;"> <col> </colgroup> <tbody><tr> <td>Tytuł:</td> <td> <input class="pole" type="text" name="tytul"> </td> </tr> <tr> <td>Obrazek:</td> <td> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $ustawienia['max_file_size']*1024; ?>" /> <!--maksymalna wielkość pliku w bajtach--> <input name="obrazek" type="file" /> <span style="color:#595959">(max. <?php echo $ustawienia['max_file_size']; ?>KB)</span> </td> </tr> <tr> <td>Źródło:</td> <td><input class="pole" type="tekst" name="zrodlo"></td> </tr> <tr> <td></td> <td> <input type="submit" name="submit_obrazek" class="button" value="Dodaj" /> </td> </tr> </tbody></table> </form> <?php } else { { if(!$_POST['tytul_filmu'] || !$_POST['adres_filmu']) { echo '<b>Nie wypełniono pola z tytułem lub adresem filmu!</b><br/><a href="dodaj.php?co=film">« Powrót</a>'; } else { { $tytul=$_POST['tytul_filmu']; $autor=$_SESSION['login']; $zapytanie = "INSERT INTO `shity` (`id`, `tytul`, `obrazek`, `zrodlo`, `autor`, `data`, `typ`) VALUES ('', '$tytul', '$adres_filmu', 'YouTube', '$autor', '$data', 'film')"; echo '<b>Filmik został pomyślnie dodany!</b><br/> <a href="index.php">« Strona Główna</a>'; } else { } } } else { ?> <div id="tab"> <ul> <li><a href="dodaj.php?co=obrazek"><img src="img/photo.png" style="position:relative;top:3px;"/> Dodaj Obrazek</a></li> <li id="selected"><a href="dodaj.php?co=film"><img src="img/film.png" style="position:relative;top:3px;"/> Dodaj filmik z YouTube</a></li> </ul> </div> <div id="tab_linia"></div> <form action="dodaj.php?co=film" method="post" enctype="multipart/form-data"> <table> <colgroup> <col width="120px;"> <col> </colgroup> <tbody><tr> <td>Tytuł:</td> <td> <input class="pole" type="text" name="tytul_filmu"> </td> </tr> <tr> <td>Adres filmu:</td> <td> <input class="pole" type="text" name="adres_filmu"> <span style="color:#595959">np. <a href="http://www.youtube.com/watch?v=7BfGua1Hn-8</span>" target="_blank">http://www.youtube.com/watch?v=7BfGua1Hn-8</span></a> </td> <tr> <td></td> <td> <input type="submit" name="submit_film" class="button" value="Dodaj" /> </td> </tr> </tbody></table> </form> <?php } } } } else { echo 'Aby dodać nowy obrazek musisz być zalogowany.<br/><br/> <a href="login.php" class="button" style="float:left;">Logowanie</a> <a href="rejestracja.php" class="button" style="margin-left:10px;float:left;">Rejestracja</a> <div style="clear:left;"></div>'; } ?> </div> <div id="stopka"> <?php include('tpl/stopka.php') ?> </div> </body> </html>
ZNAK WODNY:
[/php]$photo = 'tatry_foto.jpg'; $image = imagecreatefromjpeg($photo); $watermark = imagecreatefromjpeg('watermark_dc.jpg'); $width = imagesx($image); $height = imagesy($image); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); imagecopymerge($image, $watermark, (($width - $watermark_width))-10, (($height - $watermark_height))-10, 0, 0, $watermark_width, $watermark_height, 100); imagejpeg($image); imagedestroy($image); imagedestroy($watermark);[php]