Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

problem sa imagejpeg funkcijom

[es] :: PHP :: problem sa imagejpeg funkcijom

[ Pregleda: 1806 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

sheik
Vanja Al Halidi
executive director, Implementek
Beograd

Član broj: 104596
Poruke: 58
*.static.sbb.co.yu.

Sajt: www.implementek.com


Profil

icon problem sa imagejpeg funkcijom28.12.2006. u 14:42 - pre 210 meseci
Ovaj kod bi trebao da prilikom uploada slike napravi thumb velicine 80x60 i postavi ga na isto mesto gde i original sliku.
Code:

$new_height=60;
$new_width=80;
$allowed_types = array(
'image/pjpeg',
'image/gif',
'image/png',
'image/jpeg');
if(in_array($_FILES['userfile']['type'], $allowed_types))
{
copy ($_FILES['userfile']['tmp_name'], $_FILES['userfile']['name']) or die ("Could not copy");
$imagefile=$_FILES['userfile']['name'];
list($width, $height) = getimagesize($_FILES['userfile']['name']);
$image_p = imagecreatetruecolor($new_width,$new_height);
if ($_FILES['userfile']['type'] == "image/gif")
{
$img = @imagecreatefromgif($imagefile);
imagecopyresampled($image_p, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
$thename=$_FILES['userfile']['name'];
$thenames="thumb$thename";
$location="$thenames";
imagegif($image_p,$location, 100);
}
else
{
$img = @imagecreatefromjpeg($imagefile);
imagecopyresampled($image_p, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
$thename=$_FILES['userfile']['name'];
$thenames="thumb$thename";
$location="$thenames";
imagejpeg($image_p,$location, 100);
}
}


To sve lepo sljaka na localhostu, nemam zamerke :) , medjutim kada kod postavim na net, thumb se uopste ne kreira, vec se uplouaduje samo originalna slika. ?!?

Ja kod sebe gde sve lepo radi imam PHP Version 5.2.0 i GD Version bundled (2.0.28 compatible),
dok je kod provajdera PHP Version 4.3.2 i GD Version bundled (2.0.12 compatible)

U cemu je problem.
Ako hvatas male ribice, mozes da ostanes u plicaku, za veliku ribu, moras da zagazis dublje !
 
Odgovor na temu

sheik
Vanja Al Halidi
executive director, Implementek
Beograd

Član broj: 104596
Poruke: 58
*.static.sbb.co.yu.

Sajt: www.implementek.com


Profil

icon Re: problem sa imagejpeg funkcijom28.12.2006. u 15:11 - pre 210 meseci
Nema problema,
moja greska.
bilo je slovo vishka
Sorry :)

Ako hvatas male ribice, mozes da ostanes u plicaku, za veliku ribu, moras da zagazis dublje !
 
Odgovor na temu

Error404
freelancer
Zemun

Član broj: 37243
Poruke: 104
*.adsl.beocity.net.



Profil

icon Re: problem sa imagejpeg funkcijom01.01.2007. u 20:12 - pre 210 meseci
Zasto me to uopste ne cudi. He he :)
nvdizajn.freezoka.com
 
Odgovor na temu

[es] :: PHP :: problem sa imagejpeg funkcijom

[ Pregleda: 1806 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.