thumpnail af bmp med fx imagewbmp i PHP
<?function createthumb($name,$filename,$new_w,$new_h){
$system=explode('.',$name);
if (preg_match('/jpg|jpeg/',$system[1])) $src_img=imagecreatefromjpeg($name);
if (preg_match('/GIF|gif/',$system[1])) $src_img=imagecreatefromgif($name);
// if (preg_match('/wbmp/',$system[1])) $src_img=imagecreatefromwbmp($name);
if (preg_match('/png/',$system[1])) $src_img=imagecreatefrompng($name);
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y) {
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y) {
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y) {
$thumb_w=$new_w;
$thumb_h=$new_h;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
if (preg_match("/gif|GIF/",$system[1])) imagegif($dst_img,$filename);
if (preg_match("/png/",$system[1])) imagepng($dst_img,$filename);
if (preg_match("/jpg|jpeg|JPEG|JPG/",$system[1])) imagejpeg($dst_img,$filename);
// if (preg_match("/bmp|BMP/",$system[1])) imagewbmp($dst_img,$filename);
imagedestroy($dst_img);
imagedestroy($src_img);
}
?>
Jeg har med hjælp herfra og hjælp fra nettet fået bixet ovenstående funktion sammen, men jeg mangler at kunne håndtere bmp filer, er der nogen som har gode råd?
Jeg vil gerne kunne lave en tommeltåt udfra et bmp-billede, hvordan gøres det i PHP?
