MyBB Community Forums

Full Version: Avatar image auto resizer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
it recalculates the maximum size for the avatar uploaded
Upload edilen avatarı maxiumum boyutlara göre yeniden çizip üzerine yazıyor.
ingilizcem kıttırda biraz (:

coded whit GD liblary
GD kütüphaneleriyle kodlanmıştır

open inc/functions_upload.php
inc/functions_upload.php'i açın

Find
Bulun
	// If we've got this far check dimensions
	if($mybb->settings['maxavatardims'] != "")
	{
		list($maxwidth, $maxheight) = @explode("x", $mybb->settings['maxavatardims']);
		if(($maxwidth && $img_dimensions[0] > $maxwidth) || ($maxheight && $img_dimensions[1] > $maxheight))
		{
			$ret['error'] = sprintf($lang->error_avatartoobig, $maxwidth, $maxheight);
			@unlink($mybb->settings['avataruploadpath']."/".$filename);
			return $ret;
		}
	}

replice by..
Değiştirin..

	// If we've got this far check dimensions
	if($mybb->settings['maxavatardims'] != "")
	{
		list($maxwidth, $maxheight) = @explode("x", $mybb->settings['maxavatardims']);
		if(($maxwidth && $img_dimensions[0] > $maxwidth) || ($maxheight && $img_dimensions[1] > $maxheight))
		{
		//sTaRs Resize entegrasyonu (:	
		if ($maxwidth && ($img_dimensions[0]< $img_dimensions[1])) {
			$maxwidth = ($maxheight / $img_dimensions[1]) * $img_dimensions[0];
		} else {
			$maxheight = ($maxwidth / $img_dimensions[0]) * $img_dimensions[1];
		}
			$resimcik=$mybb->settings['avataruploadpath']."/".$filename;
			$image_sTR47 = imagecreatetruecolor($maxwidth, $maxheight);
			$image = imagecreatefromjpeg($resimcik);
			imagecopyresampled($image_sTR47, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_dimensions[0], $img_dimensions[1]);
			imagejpeg($image_sTR47, $resimcik, 100);
			$img_dimensions[0]=$maxwidth;
			$img_dimensions[1]=$maxheight;
		}
	}
a code by sTaRs

requirements: GD2 Library
gereksinimler: GD2 Library

saygılarımla sTaRs
thanks to feldmaresal for english
this is not working for me
this works, but has problems.