Avatar billede okidoky Nybegynder
08. juni 2009 - 19:47

Uploade af picture

Jeg kunne godt uploade billeder med denne script fra en domæne på one.com, men på surftown.dk gider den ikke uploade billedet ... why???




function createT_img($imgName, $sou, $mappen) {

    //resize image to put it into db
    $imagename = $imgName;
    $source = $sou; //$_FILES['img1']['tmp_name'];
    $target = $mappen."/".$imagename;
    $map = $mappen;
    move_uploaded_file($source, $target);
   
    $imagepath = $imagename;
    $save = $mappen ."/". $imagepath; //This is the new file you saving
    $file = $mappen ."/". $imagepath; //This is the original file
   
    list($width, $height) = getimagesize($file) ;
   
    $modwidth = $width;
   
    $diff = $width / $modwidth;
   
    $modheight = $height / $diff;
    $tn = imagecreatetruecolor($modwidth, $modheight) ;
    $image = imagecreatefromjpeg($file) ;
    imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
   
    imagejpeg($tn, $save, 100) ;
   
    $save = $mappen ."/sml_" . $imagepath; //This is the new file you saving
    $file = $mappen ."/". $imagepath; //This is the original file
   
    list($width, $height) = getimagesize($file) ;
   
    $modwidth = 260;
   
    $diff = $width / $modwidth;
   
    $modheight = $height / $diff;
    $tn = imagecreatetruecolor($modwidth, $modheight) ;
    $image = imagecreatefromjpeg($file) ;
    imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
   
    imagejpeg($tn, $save, 100) ;
    return $imagepath;
   
   
    }
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester