function make_bigpics(&$start) { global $table_prefix; global $link; global $profilepicspath; global $bigpicspath; $perpage = 1000; $result = mysql_query("SELECT pic.*, u.profilepicrevision, u.bigpicrevision FROM " . $table_prefix . "customprofilepic as pic, " . $table_prefix . "user as u \n WHERE pic.userid = u.userid AND u.bigpicsaved = 0 ORDER BY pic.userid LIMIT {$start}, {$perpage}", $link); if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { $img_editor = new vB_AdvancedProfilePhoto($profilepicspath . 'profilepic' . $row['userid'] . "_" . $row['profilepicrevision'] . ".gif"); $img_editor->save_to_file($bigpicspath . $row['userid'] . "_" . $row['bigpicrevision'] . ".jpg"); unset($img_editor); mysql_query("REPLACE INTO " . $table_prefix . "custombigpic\n SET `userid` = " . $row['userid'] . ", `sel_top` = 0, `sel_left` = 0, `dateline` = " . time() . ",\n `sel_width`= " . $row['width'] . ", `sel_height`= " . $row['height'] . ",`width`= " . $row['width'] . ", `height`= " . $row['height']); // change revision of uploaded file mysql_query("UPDATE " . $table_prefix . "user SET `bigpicrevision` = " . ($row['bigpicrevision'] + 1) . ", `bigpicsaved` = 1 WHERE userid = " . $row['userid']); } $start = $start + 1000; echo "Processing {$start} pics\n"; make_bigpics($start); } }
if ($_REQUEST['do'] == 'make_preview' and $show['member']) { $vbulletin->input->clean_array_gpc('r', array('top' => TYPE_UINT, 'left' => TYPE_UINT, 'height' => TYPE_UINT, 'width' => TYPE_UINT)); require_once DIR . '/includes/class_advanced_profile_photo.php'; $left = $vbulletin->GPC['left'] < 0 ? 0 : $vbulletin->GPC['left']; $top = $vbulletin->GPC['top'] < 0 ? 0 : $vbulletin->GPC['top']; $height = $vbulletin->GPC['height'] > vB_AdvancedProfilePhoto::MAX_HEIGHT ? vB_AdvancedProfilePhoto::MAX_HEIGHT : $vbulletin->GPC['height']; $width = $vbulletin->GPC['width'] > vB_AdvancedProfilePhoto::MAX_WIDTH ? vB_AdvancedProfilePhoto::MAX_WIDTH : $vbulletin->GPC['width']; $target_path = $vbulletin->options['app_img_folder'] . "/" . $vbulletin->userinfo['userid'] . "_" . $vbulletin->userinfo['bigpicrevision'] . ".jpg"; $img_editor = new vB_AdvancedProfilePhoto($target_path); if ($img_editor) { $img_editor->img_crop_resize_from_src($vbulletin->options['app_avatar_size'], $vbulletin->options['app_avatar_size'], $left, $top, $width, $height); $img_editor->unsharp_mask(); $img_editor->round_corner($vbulletin->options['app_corners_radius']); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Pragma: no-cache'); // HTTP/1.0 header('Content-transfer-encoding: binary'); header("Content-type: image/png"); echo $img_editor->get_img_binary(); exit; } } // by default return cleargif header("Content-type: image/png"); $clear_gif = new vB_AdvancedProfilePhoto($vbulletin->options['cleargifurl']); echo $clear_gif->get_img_binary();