Autor | Zpráva | ||
---|---|---|---|
pepas Profil * |
#1 · Zasláno: 20. 5. 2008, 17:59:21
Dobry den pouzivam tuto tridu na generovani 3 ruznych velikosti jednoho obrazku
class thumbnail { /** * zdrojovy soubor * @access private * @var blob */ var $sourceFile; // z tohoto se dela nahled var $originalFilename; // pro ziskani dalsic informaci var $destinationDirectory; // slozka pro data var $destinationDirectoryFilename; // vysledny soubor var $createImageFunction = ''; var $outputImageFunction = ''; function generate($sourceFile = "", $originalFilename = "", $destinationDirectory = "", $destinationDirectoryFilename = "", $width = -1, $height = -1) { if (!empty($sourceFile)) $this->sourceFile = $sourceFile; if (!empty($originalFilename)) $this->originalFilename = $originalFilename; if (!empty($destinationDirectory)) $this->destinationDirectory = $destinationDirectory; if (!empty($destinationDirectoryFilename)) $this->destinationDirectoryFilename = $destinationDirectoryFilename; if (!empty($width)) $this->width = $width; if (!empty($height)) $this->height = $height; list(, $this->extension) = explode('.', $this->originalFilename); switch ($this->extension) { case 'gif' : $createImageFunction = 'imagecreatefromgif'; $outputImageFunction = 'imagegif'; break; case 'png' : $createImageFunction = 'imagecreatefrompng'; $outputImageFunction = 'imagepng'; break; case 'jpg': case 'jpeg': $createImageFunction = 'imagecreatefromjpeg'; $outputImageFunction = 'imagejpeg'; break; default : exit("Prominte, tento format '{$this->extension}' neni podporovan. Podporovan jen .jpg, .png, .gif malymi pismeny. Musite prepsat nazvy souboru"); break; } $this->img = $createImageFunction($this->sourceFile); // vyska/sirka list($this->org_width, $this->org_height) = getimagesize($this->sourceFile); if ($this->height == -1) { $this->height = round($this->org_height * $this->width / $this->org_width); } if ($this->width == -1) { $this->width = round($this->org_width * $this->height / $this->org_height); } $this->xoffset = 0; $this->yoffset = 0; $this->img_new = imagecreatetruecolor($this->width, $this->height) or die ("FATAL ERROR GD"); if ($this->img_new) { // resample obrazku imagecopyresampled($this->img_new, $this->img, 0, 0, $this->xoffset, $this->yoffset, $this->width, $this->height, $this->org_width, $this->org_height); list($this->newFilename) = explode('.', $this->destinationDirectoryFilename); // cesta k vyslednemu souboru $this->fullDestination = ($this->destinationDirectory.'/'.$this->newFilename.'.'.$this->extensi on); $outputImageFunction($this->img_new, $this->fullDestination); } else { $this->failed = true; } if ($this->failed == false) { return $this->fullDestination; } } } trida by mela byt funkcni. Bohuzel ale nedela co ma a to je upload obrazku na server. Php mi hlasi chybu Warning: imagejpeg() [function.imagejpeg]: Unable to open 'thumb/uploads/14_lrg.jpg' for writing: No such file or directory in P:\EasyEclipse\workspace\mimibazar\inc\thumb\thumbnail.class.php on line 103 Warning: imagejpeg() [function.imagejpeg]: Unable to open 'thumb/uploads/14_med.jpg' for writing: No such file or directory in P:\EasyEclipse\workspace\mimibazar\inc\thumb\thumbnail.class.php on line 103 Warning: imagejpeg() [function.imagejpeg]: Unable to open 'thumb/uploads/14_sml.jpg' for writing: No such file or directory in P:\EasyEclipse\workspace\mimibazar\inc\thumb\thumbnail.class.php on line 103 Paramtetry predavam spravne, nevite kde by mohla byt chyba? |
||
nightfish Profil |
#2 · Zasláno: 20. 5. 2008, 18:08:22
Paramtetry predavam spravne, nevite kde by mohla byt chyba?
víme soubor 'thumb/uploads/14_lrg.jpg' v adresáři P:\EasyEclipse\workspace\mimibazar\inc\thumb\ neexistuje |
||
pepas Profil * |
#3 · Zasláno: 20. 5. 2008, 18:14:23
no jasne ale nechapu proc jej tam ta trida nenahraje? nebo to mam delat ja rucne?
|
||
nightfish Profil |
#4 · Zasláno: 20. 5. 2008, 18:16:43
teda spíš jsem měl napsat, že neexistují adresáře thumb a/nebo thumb/uploads na uvedené cestě... ty zřejmě bude potřeba vytvořit ručně
|
||
pepas Profil * |
#5 · Zasláno: 20. 5. 2008, 18:24:47
Tyto adresare existuji, ale trida do nich nic nevyexportuje, cili zadne obrazky neobsahuje.
|
||
nightfish Profil |
#6 · Zasláno: 20. 5. 2008, 18:27:23
ještě jednou
existuje adresář P:\EasyEclipse\workspace\mimibazar\inc\thumb\thumb a P:\EasyEclipse\workspace\mimibazar\inc\thumb\thumb\uploads (protože PHP tvrdí, že ne) ještě mě napadá - není náhodou P nějaká síťová jednotka? resp. má na ni uživatel, pod kterým běží apache, přístup? |
||
pepas Profil * |
#7 · Zasláno: 20. 5. 2008, 18:56:40
super byla to chyba adresarove struktury v nastaveni stacilo dopsat inc a hotovo, diky
|
||
Časová prodleva: 16 let
|
0