[ 01011011 @ 12.11.2006. 11:23 ] @
imam problem kada koristim resize() funkciju. Naime sve mi radi kako treba i kada uradim upload slike na server slika se resajzuje i pojavi i uploduje na server. E sada se pitate pa sta je onda problem. Pa problem je u tome sto se slika sacuva u folderu koji ja zelim sa '600' permissions, a ja bih zeleo da sacuvam kao 755 ili 777 permissions. Kad zelim posle da promjenim manualno na FTP permissions ne da mi server da mjenjam. Ne znam sta je problem. evo koda Code: <?php if($_GET['pic']){ $img = new img('grbovi/'.$_GET['pic']); $img->resize(); $img->show(); } class img { var $image = ''; var $temp = ''; function img($sourceFile){ if(file_exists($sourceFile)){ $this->image = ImageCreateFromJPEG($sourceFile); } else { $this->errorHandler(); } return; } function resize($width = 180, $height = 180, $aspectradio = true){ $o_wd = imagesx($this->image); $o_ht = imagesy($this->image); if(isset($aspectradio)&&$aspectradio) { $w = round($o_wd * $height / $o_ht); $h = round($o_ht * $width / $o_wd); if(($height-$h)<($width-$w)){ $width =& $w; } else { $height =& $h; } } $this->temp = imageCreateTrueColor($width,$height); imageCopyResampled($this->temp, $this->image, 0, 0, 0, 0, $width, $height, $o_wd, $o_ht); $this->sync(); return; } function sync(){ $this->image =& $this->temp; unset($this->temp); $this->temp = ''; return; } function show(){ $this->_sendHeader(); ImageJPEG($this->image); return; } function _sendHeader(){ header('Content-Type: image/jpeg'); } function errorHandler(){ echo "error"; exit(); } function store($file){ ImageJPEG($this->image,$file); return; } function watermark($pngImage, $left = 0, $top = 0){ ImageAlphaBlending($this->image, true); $layer = ImageCreateFromPNG($pngImage); $logoW = ImageSX($layer); $logoH = ImageSY($layer); ImageCopy($this->image, $layer, $left, $top, 0, 0, $logoW, $logoH); } } ?> |