Avatar yüklerken boyutu büyük olan Avatarinizi bu Hack sayesinde otomatikmen izin verilen Boyuta getirilecektir

2.3.4 de denenmistir

usercp.php ac ve ara

[php] $wbbuserdata['max_avatar_width'] || $height > $wbbuserdata['max_avatar_height'] || !$width || !$height) $badavatar = 2; ?>[/php]

Bu KodLAr İLe degistir

[php] 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;
}
}
} ?>[/php]

Etiketler:
Beğeniler: 0
Favoriler: 0
İzlenmeler: 646
favori
like
share