بابهت: وێنهبچکۆلهی ئهندام ڕاستهوخۆ بچوک بکهرهوه
سڵاو هاوڕێیان،
زۆرێک له بهڕێوبهران وێنه بچکۆله ناچالاک دهکهن به هۆی ئهوهی ئهندامان وێنهیگهوه دا ئه نێن ،که ئهمهش ئهبێته هۆی خاو بونهوهی پهڕهکانو یانهکهش
ئێستا ئهتوانیت به هۆی کۆمهڵێ گۆڕان کاریهوه له پهڕهکان ،ههر ئهندامێک وێنهبچکۆلهکهی زۆرر گهوهرهش بێت ،ئهم بچوکی ئهکاتهوه به شێوهیهکی خۆکارانه
جێبهجێ کردن:
#
#---------[ 1. ئهم پهڕهیه بکهرهوه ]---------------------------------------------------------
#
profile.php
#
#---------[دێڕی 412 ]-----------------------------------------------
#
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $pun_config['o_avatars_size'] ?>" />
#
#---------[ 3. بیگۆڕه بۆ ئهم دێرهی خوارهوه ]--------------------------------------------------
#
<!--<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $pun_config['o_avatars_size'] ?>" />-->
#
#---------[ ئهم دێڕه بدۆزهرهوه 368 ]-----------------------------------------------
#
// Now check the width/height
list($width, $height, $type,) = getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
if (empty($width) || empty($height) || $width > $pun_config['o_avatars_width'] || $height > $pun_config['o_avatars_height'])
{
@unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
message($lang_profile['Too wide or high'].' '.$pun_config['o_avatars_width'].'x'.$pun_config['o_avatars_height'].' '.$lang_profile['pixels'].'.');
}
else if ($type == 1 && $uploaded_file['type'] != 'image/gif') // Prevent dodgy uploads
{
@unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
message($lang_profile['Bad type']);
}
#
#---------[ 5. بیگۆڕه بۆ]--------------------------------------------------
#
// Now check the width/height
list($width, $height, $type,) = getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
if (empty($width) || empty($height) || $width > $pun_config['o_avatars_width'] || $height > $pun_config['o_avatars_height'])
{
// Attempt to resize if GD is installed with support for the uploaded image type, as well as JPG for the output
$check_type = str_replace(array(1, 2, 3), array('IMG_GIF', 'IMG_JPG', 'IMG_PNG'), $type);
if (extension_loaded('gd') && imagetypes() & constant($check_type) && imagetypes() & IMG_JPG)
{
// Load the image for processing
if ($type == 1) $src_img = @imagecreatefromgif($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
elseif ($type == 2) $src_img = @imagecreatefromjpeg($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
elseif ($type == 3) $src_img = @imagecreatefrompng($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
if ($src_img)
{
// Figure out new image dimensions based on the maximum width
$new_w = $pun_config['o_avatars_width'];
$ratio = $height * $new_w;
$new_h = $ratio / $width;
// Do the new dimensions, based on the maximum width, fit the maximum height? If not, recalculate
if ($new_h > $pun_config['o_avatars_height'])
{
$new_h = $pun_config['o_avatars_height'];
$ratio = $width * $new_h;
$new_w = $ratio / $height;
}
// Resize the image
$new_img = imagecreatetruecolor($new_w, $new_h);
imagecopyresampled($new_img, $src_img, 0, 0, 0, 0, $new_w, $new_h, $width, $height);
// Delete the old image and write the newly resized one
@unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
imagejpeg($new_img,$pun_config['o_avatars_dir'].'/'.$id.'.tmp',85);
// Set the extension to JPG, since that's what the resized image is now
$extensions[0] = '.jpg';
}
// Something went wrong while attempting to load the image for processing
else
{
@unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
message('An unexpected error occured while attempting to resize the image.');
}
}
// No GD installed or image type not supported; can't resize
else
{
@unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
message($lang_profile['Too wide or high'].' '.$pun_config['o_avatars_width'].'x'.$pun_config['o_avatars_height'].' '.$lang_profile['pixels'].'.');
}
}
else if ($type == 1 && $uploaded_file['type'] != 'image/gif') // Prevent dodgy uploads
{
@unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp');
message($lang_profile['Bad type']);
}
// Make sure the file isn't too big
if (filesize($pun_config['o_avatars_dir'].'/'.$id.'.tmp') > $pun_config['o_avatars_size'])
message($lang_profile['Too large'].' '.$pun_config['o_avatars_size'].' '.$lang_profile['bytes'].'.');
#
#---------[ ئهم دوو دێڕهش بسرهوه که ئهکهونه دێر 351 و352]-----------------------------------------------
#
// Make sure the file isn't too big
if ($uploaded_file['size'] > $pun_config['o_avatars_size'])
message($lang_profile['Too large'].' '.$pun_config['o_avatars_size'].' '.$lang_profile['bytes'].'.');
#
#---------[ 7. سهیڤی کهو بهرزی کهرهوه بۆ ڕاژهکهت ]-------------------------------------------------
#