24. maj 2009 - 21:02Der er
5 kommentarer og 1 løsning
Resize picture
Har fået denne kode, men der sker ingen ting. Jeg for ingen fejl koder, eller noget som tyder på noget forkert. Men der kommer heller ikke noget billed:
$mappe = billed/mave/ $newfilename = ugeXX_1.jpg Mappe/Filnavn efter udførelse: "billed/mave/ugeXX_1b.jpg"
function resizeToFile ($sourcefile, $dest_x, $dest_y, $targetfile, $jpegqual) {
/* Get the dimensions of the source picture */ $picsize=getimagesize("$sourcefile"); $source_x = $picsize[0]; $source_y = $picsize[1]; $source_id = imageCreateFromJPEG("$sourcefile");
/* Create a new image object (not neccessarily true colour) */ $target_id=imagecreatetruecolor($dest_x, $dest_y);
/* Resize the original picture and copy it into the just created image object. Because of the lack of space I had to wrap the parameters to several lines. I recommend putting them in one line in order keep your code clean and readable */ $target_pic=imagecopyresampled($target_id,$source_id,0,0,0,0,$dest_x,$dest_y,$source_x,$source_y);
/* Create a jpeg with the quality of "$jpegqual" out of the image object "$target_pic". This will be saved as $targetfile */ imagejpeg ($target_id,"$targetfile",$jpegqual); return true; } ?>
function resizeToFile ($sourcefile, $dest_x, $dest_y, $targetfile, $jpegqual) {
/* Get the dimensions of the source picture */ $picsize=getimagesize("$sourcefile"); $source_x = $picsize[0]; $source_y = $picsize[1]; $source_id = imageCreateFromJPEG("$sourcefile");
/* Create a new image object (not neccessarily true colour) */ $target_id=imagecreatetruecolor($dest_x, $dest_y);
/* Resize the original picture and copy it into the just created image object. Because of the lack of space I had to wrap the parameters to several lines. I recommend putting them in one line in order keep your code clean and readable */ $target_pic=imagecopyresampled($target_id,$source_id,0,0,0,0,$dest_x,$dest_y,$source_x,$source_y);
/* Create a jpeg with the quality of "$jpegqual" out of the image object "$target_pic". This will be saved as $targetfile */ imagejpeg ($target_id,"$targetfile",$jpegqual); return true; }
Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 12288 bytes) in /customers/tbf-web.dk/tbf-web.dk/httpd.www/billed/maveresize_b.php on line 15
Jeg er glad for at du har fået det til at virke. Tilykke med det.
Synes godt om
Ny brugerNybegynder
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.