25. februar 2003 - 18:58Der er
14 kommentarer og 1 løsning
GD lib 1.6.2 What to do ?
Jeg har et prob med GD. Mit webhotel får ikke ny GDlib version før til sommer så hvad kan jeg og kan jeg ikke med GD lib 1.6.2 (tror det er installeret?)
hæ hæ .. det er ikke afprøvet med GDlib 1.6.2, men det burde virke .. Resize() funktionen burde virke fint på den version .. men Resample() kun virker å GDlib 2+
horsmark: Jeg har bruger denne resize, som er funky nok under GDLib 1.6.2: //BIG THUMBNAIL $src_dim = getimagesize($final_dir.$renamed);
//Set correct dimensions for new image (thumb) if($src_dim[0] < $src_dim[1]){ $dest_width = 350; $dest_height = 500; } else { $dest_width = 500; $dest_height = 350; } //Create thumb dependent of image type if($ext == "jpg"){
//Create a image in buffer from source image $src_img = imagecreatefromjpeg("$final_dir"."$renamed");
//Create distination image in buffer with correct dimensions $dst_img = imagecreatetruecolor($dest_width,$dest_height); //should be imagecreatetruecolor, but no supported by azero
//Copy the image from source to destination imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, //should be imagecopyresampled, but no supported by azero $dest_height, $src_dim[0], $src_dim[1]); imagejpeg($dst_img, $final_dir.$renamed, $quality_big);
//Destroy the buffers imagedestroy($src_img); imagedestroy($dst_img);
} else { echo '<script type="text/javascript">uploadWin = window.open("uploadAlert.php?closeWin=2","uploadWin", "width=500, height=200");</script>'; error("Forkert filtype. Det er kun muligt at uploade billeder af filtypen *.jpg"); }
//SMALL THUMBNAIL //Get size of big image $src_dim = getimagesize($final_dir.$renamed);
//Set correct dimensions for new image (thumb) if($src_dim[0] < $src_dim[1]){ $dest_width = 66; $dest_height = 100; } else { $dest_width = 100; $dest_height = 66; } //Create thumb dependent of image type if($ext == "jpg"){
//Create a image in buffer from source image $src_img = imagecreatefromjpeg("$final_dir"."$renamed");
//Create distination image in buffer with correct dimensions $dst_img = imagecreatetruecolor($dest_width,$dest_height); //should be imagecreatetruecolor, but no supported by azero
//Copy the image from source to destination imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, //should be imagecopyresampled, but no supported by azero $dest_height, $src_dim[0], $src_dim[1]); imagejpeg($dst_img, $final_dir."/thumbs/".$renamed, $quality);
//Destroy the buffers imagedestroy($src_img); imagedestroy($dst_img);
} else { echo '<script type="text/javascript">uploadWin = window.open("uploadAlert.php?closeWin=2","uploadWin", "width=500, height=200");</script>'; error("Forkert filtype. Det er kun muligt at uploade billeder af filtypen *.jpg"); } if(file_exists($temp_dir.$renamed)){ unlink($temp_dir.$renamed); }
det er en del kode og du skal ændre noget (bla. error() kald), men pointen er at du skal erstatte: imagecopyresampled --> imagecopy og imagecreatetruecolor --> imagecreate
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.