DeeJay-Luke
Mitglied
Ich will das der Code mir das Hochgeladene Bild, eine Breite von 300px erstellt, die Höche soll sich anpassen...
Wo soll die die 300 ändern
Wo soll die die 300 ändern
PHP:
if ($badavatar == 0) {
if($width>$wbbuserdata['max_avatar_width'] || $height>$wbbuserdata['max_avatar_height']) {
$resizeFactor = min(($wbbuserdata['max_avatar_height']/$height), ($wbbuserdata['max_avatar_width']/$width));
if($imgsize[2] == 1) $im = ImageCreateFromGIF("./images/avatars/avatar-".$avatarid.".".$avatar_file_extension);
else if($imgsize[2] == 2) $im = ImageCreateFromJPEG("./images/avatars/avatar-".$avatarid.".".$avatar_file_extension);
else if($imgsize[2] == 3) $im = ImageCreateFromPNG("./images/avatars/avatar-".$avatarid.".".$avatar_file_extension);
else $badavatar = 2;
if($badavatar == 0) {
if (function_exists("imagecreatetruecolor") && function_exists("imagecopyresampled")) {
$new_im = imagecreatetruecolor($imgsize[0]*$resizeFactor,$imgsize[1]*$resizeFactor);
$success1 = imagecopyresampled($new_im,$im,0,0,0,0,ImageSX($new_im),ImageSY($new_im),ImageSX($im),ImageSY($im));
}
else {
$new_im = @ImageCreate($imgsize[0]*$resizeFactor,$imgsize[1]*$resizeFactor);
$success1 = @ImageCopyResized($new_im,$im,0,0,0,0,ImageSX($new_im),ImageSY($new_im),ImageSX($im),ImageSY($im));
}
$success2 = @ImageJPEG($new_im,"./images/avatars/avatar-".$avatarid.".jpg",95);
if ($success1 && $success2) {
$db->query("UPDATE bb".$n."_avatars SET avatarextension = 'jpg' WHERE avatarid='".$avatarid."'");
$width = $imgsize[0]*$resizeFactor;
$height = $imgsize[1]*$resizeFactor;
}
else $badavatar=2;
}
}
}