Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] biblioteka GD
pejot
post 3.12.2008, 01:25:34
Post #1





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 3.02.2008

Ostrzeżenie: (0%)
-----


Witam,
Mam taki problem z moim kodem i biblioteką GD proszę o pomoc. A skrypt z którym mam problem ma tworzyć watermark'a z miniatury i ramki.

oto błędy:


A oto kod:

  1. <?php
  2. ini_set('display_errors', 1);
  3. ?>
  4. require_once '../library/config.php';
  5. require_once '../library/functions.php';
  6. if(isset($_POST['txtName']))
  7. {
  8.    $albumName = $_POST['txtName'];
  9.    $albumDesc = $_POST['mtxDesc'];
  10.  
  11.    $imgName   = $_FILES['fleImage']['name'];
  12.    $tmpName   = $_FILES['fleImage']['tmp_name'];
  13.  
  14.    // we need to rename the image name just to avoid
  15.    // duplicate file names
  16.    // first get the file extension
  17.    $ext = strrchr($imgName, \".\");
  18.    
  19.    // then create a new random name
  20.    $newName = md5(rand() * time()) . $ext;
  21.  
  22.    // the album image will be saved here
  23.    $imgPath = ALBUM_IMG_DIR . $newName;
  24.    
  25.    // resize all album image
  26.    $result = createThumbnail($tmpName, $imgPath, THUMBNAIL_WIDTH);
  27.    
  28.    if (!$result) {
  29.        echo \"Error uploading file\";
  30.        exit;
  31.    }
  32.    
  33.    if (!get_magic_quotes_gpc()) {
  34.        $albumName  = addslashes($albumName);
  35.        $albumDesc  = addslashes($albumDesc);
  36.    }  
  37.    
  38.    // dodawanie ramki
  39.    $ramka = imagecreatefrompng('ramka.png'); //szytywanie pliku
  40.    $obrazki =imagecreatefromjpeg('$result');
  41.    imagejpeg($ramka, $obrazki); //zapisywanie
  42.    imagedestroy($ramka);
  43.    imagedestroy($obrazki);    
  44.    $query = \"INSERT INTO tbl_album (al_name, al_description, al_image, al_date)
  45.              VALUES ('$albumName', '$albumDesc', '$newName', NOW())\";
  46.  
  47.    mysql_query($query) or die('Error, add album failed : ' . mysql_error());                    
  48.  
  49.  
  50.  
  51.    // the album is saved, go to the album list
  52.    echo \"<script>window.location.href='index.php?page=list-album';\";
  53.    
  54.    exit;
  55. }        
  56. ?>


Ten post edytował pejot 3.12.2008, 01:28:34
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
AxZx
post 3.12.2008, 08:29:24
Post #2





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 55
Dołączył: 1.03.2005
Skąd: śląsk

Ostrzeżenie: (0%)
-----


przecież masz napisane, że nie ma takiego pliku jak $result.


--------------------
aplikacje internetowe | Symfony
Go to the top of the page
+Quote Post
pejot
post 3.12.2008, 12:57:59
Post #3





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 3.02.2008

Ostrzeżenie: (0%)
-----


A linijka 28??exclamation.gif
Go to the top of the page
+Quote Post
wookieb
post 3.12.2008, 13:08:23
Post #4





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




A co znaczy zapis '$result'?
Jak juz to samo $result bez ' ' I nie krzycz bo krzyczec to powinno sie na ciebie ze nie znacz absolutnych podstaw a wpychasz sie z takimi niesamowicie blachymi pytaniami.

Ten post edytował wookieb 3.12.2008, 13:09:07


--------------------
Go to the top of the page
+Quote Post
pejot
post 3.12.2008, 14:07:14
Post #5





Grupa: Zarejestrowani
Postów: 35
Pomógł: 0
Dołączył: 3.02.2008

Ostrzeżenie: (0%)
-----


Tak pacie racje ale nie pomogło:D
Przepraszam za exclamation.gif (na nieświadomce pisałem)
Go to the top of the page
+Quote Post
wookieb
post 3.12.2008, 14:13:34
Post #6





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




A teraz zobacz sobie ladnie
Kod
var_dump($result)


I jak zobaczysz ma ona false albo cos innego.
A dlaczego? To tutaj musisz sobie sprawdzic swoja funkcje createThumbnail dlaczego zwraca ci pusta wartosc. Podstawy debugowania.


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 13:30