コード例 #1
0
 public function album()
 {
     $info = $this->upload();
     if ($info['path']) {
         $data['path'] = $info['path'];
         crop_image($info['path']);
         crop_image($info['path'], 360, 270);
         $this->apiSuccess('success', $data);
     }
     $this->apiError(0, '上传失败');
 }
コード例 #2
0
ファイル: newfeed.php プロジェクト: Emaren/agentpage
function createThumb($str_image_src, $ext, $suffix, $int_new_width, $int_new_height)
{
    if ($ext == "jpg") {
        $res_src_image = imagecreatefromjpeg($str_image_src);
    } elseif ($ext == "png") {
        $res_src_image = imagecreatefrompng($str_image_src);
    } elseif ($ext == "gif") {
        $res_src_image = imagecreatefromgif($str_image_src);
    }
    $str_image_dest = basename($str_image_src);
    $str_image_dest = 'd:/websites/myrealtornow.ca/images/' . substr($str_image_dest, 0, strrpos($str_image_dest, '.')) . $suffix . '.jpg';
    $int_new_height_tmp = get_image_height($res_src_image, $int_new_width);
    $res_dst_image = imagecreatetruecolor($int_new_width, $int_new_height);
    // Check proportions are the same.
    if ($int_new_height / $int_new_width == imageSY($res_src_image) / imageSX($res_src_image)) {
        // Resize Image
        imagecopyresampled($res_dst_image, $res_src_image, 0, 0, 0, 0, $int_new_width, $int_new_height, imagesx($res_src_image), imagesy($res_src_image));
    } else {
        // Scale Image
        $res_scaled_image = scale_image(&$res_src_image, $int_new_width, $int_new_height);
        // Crop Image
        crop_image(&$res_dst_image, &$res_scaled_image, $int_new_width, $int_new_height);
    }
    imagejpeg($res_dst_image, $str_image_dest);
}
コード例 #3
0
 // //Error
 // $errorid = $aReturn[0];
 // }
 // }
 ///----------------
 $errors = array('NO_FILE_UPLOADED' => __l('No image has been uploaded. Please select an image.'), 'INVALID_FILE_TYPE' => __l('The file type is not allowed. Upload only .bmp, .gif, .jpg or .png files.'), 'TEMP_FILE_SIZE_EXCEEDED' => __l('Unable to work with image because it is too large. It has to be {size} bytes or less.'), 'FILE_SIZE_EXCEEDED' => __l('The image file size is too large. It cannot be larger than {size} bytes.'), 'UNABLE_TO_MOVE_FILE_TO_TEMP_LOCATION' => __l('The file could not be moved to a temporary location on the server.'), 'COULD_NOT_CREATE_IMAGE' => __l('Unable to create an image from uploaded file. Ensure the file format is supported.'));
 $errors['FILE_SIZE_EXCEEDED'] = preg_replace('/\\{size\\}/', $conf['avatar_image_disk_size_in_bytes'], $errors['FILE_SIZE_EXCEEDED']);
 if ($_POST['action'] == 'upload') {
     $res = upload_image($conf, $allowed_file_types);
     if (!$res['success']) {
         $res['error'] = $errors[$res['error']];
     }
     echo json_encode($res);
     exit;
 } elseif ($_POST['action'] == 'crop_and_assign') {
     $res = crop_image($conf);
     if ($res['success']) {
         assign_image($oAvatars);
         $res['image_url'] = 'USER/' . $_SESSION['id'] . '.png';
     } else {
         $res['error'] = $errors[$res['error']];
     }
     echo json_encode($res);
     exit;
 } elseif ($_POST['action'] == 'upload_and_assign') {
     $res = upload_and_assign($conf, $oAvatars);
     if ($res['success']) {
         $res['image_url'] = 'USER/' . $_SESSION['id'] . '.png';
     } else {
         $res['error'] = $errors[$res['error']];
     }
コード例 #4
0
ファイル: upload.php プロジェクト: gauravstomar/Pepool
include "../../library/Gst/Extension.php";
$folder = explode("/", $_POST["folder"]);
$userid = decode($folder[1]);
$name = $_FILES["Filedata"]["name"];
$info = pathinfo($name);
$thumbnail = encode(rand(0, time())) . "." . $info['extension'];
$basepath = "../images/album/";
$original = $basepath . "original/" . $thumbnail;
$msql = "Inserted";
if (!in_array($info['extension'], array("gif", "GIF", "jpeg", "JPEG", "jpg", "JPG", "png", "PNG"))) {
    header("HTTP/1.x 500 Internal Server Error");
    exit;
}
move_uploaded_file($_FILES["Filedata"]["tmp_name"], $original);
crop_image($original, $basepath . "100/" . $thumbnail, 100, true);
$size = crop_image($original, $basepath . "670/" . $thumbnail, 670, true);
$conn = mysql_connect("localhost", "pepool_root", "uejipbtjtZga") or $msql = "Unable to connect to DB: " . mysql_error();
mysql_select_db("pepool_pepool") or $msql = "Unable to select mydbname: " . mysql_error();
mysql_query("INSERT INTO user_pics (uid,image,caption,height,width) VALUES ('{$userid}','{$thumbnail}','" . mysql_escape_string($name) . "','" . $size["height"] . "','" . $size["width"] . "')") or $msql = "Query error: " . mysql_error();
switch ($_FILES['Filedata']['error']) {
    case 0:
        $msg = "No Error";
        break;
    case 1:
        $msg = "The file is bigger than this PHP installation allows";
        break;
    case 2:
        $msg = "The file is bigger than this form allows";
        break;
    case 3:
        $msg = "Only part of the file was uploaded";
コード例 #5
0
ファイル: _user.class.php プロジェクト: Ariflaw/b2evolution
 /**
  * Rotate user avatar file
  *
  * @param integer the new avatar file ID
  * @param integer X coordinate (in percents)
  * @param integer Y coordinate (in percents)
  * @param integer Width (in percents)
  * @param integer Height (in percents)
  * @return object|string File object on success;
  *         Error code on denied action:
  *          'only_own_profile' - User can update only own profile
  *          'wrong_file'       - Request with wrong file ID
  *          'other_user'       - Restricted to edit files from other users
  *          'crop_error'       - Some errors in crop function
  */
 function crop_avatar($file_ID, $x, $y, $width, $height)
 {
     $File =& $this->get_File_by_ID($file_ID, $error_code);
     if (!$File) {
         // The file cannot be used for this user, return error code
         return $error_code;
     }
     global $Messages, $Settings;
     load_funcs('files/model/_image.funcs.php');
     if (!crop_image($File, $x, $y, $width, $height, intval($Settings->get('min_picture_size')), 1024)) {
         // Some errors were during rotate the avatar
         $Messages->add(T_('Profile picture could not be cropped!'), 'error');
         return 'crop_error';
     }
     $Messages->add(T_('Profile picture has been cropped.'), 'success');
     return true;
 }
コード例 #6
0
function resize_image_squared($image_path, $target_width)
{
    scale_image($image_path, $target_width, $target_width);
    // target_width suffices. squared image.
    list($width, $height) = getimagesize($image_path);
    crop_image($image_path, min($width, $height), min($width, $height));
}
コード例 #7
0
 /**
  * When making the image, the following are essential to the uniqueness
  *
  * - width
  * - height
  * - crop style
  * - the entity last modified date (if it changes, we need a new image)
  *
  * @todo should we work with original size image if available or is that overkill given the processing time required??
  * @return boolean success / failure
  */
 function _make()
 {
     $entity = $this->get_entity();
     if ($entity) {
         if ($this->_make_sure_entity_directory_exists($entity->id()) && is_writable($this->get_image_dir() . $entity->id() . '/')) {
             if ($this->_orig_exists()) {
                 $path = reason_get_image_path($entity, 'original');
             } else {
                 $path = reason_get_image_path($entity);
             }
             $newpath = $this->_get_path();
             $width = $this->_get_width();
             $height = $this->_get_height();
             $crop_style = $this->get_crop_style();
             if (empty($path)) {
                 trigger_error('reasonSizedImage could not determine the path of the original image - did not make a sized image');
             } elseif (empty($newpath)) {
                 trigger_error('reasonSizedImage could not determine the proper destination for the sized image');
             } elseif (empty($width) && empty($height)) {
                 trigger_error('reasonSizedImage needs to be provided a non-empty width or height value to create a sized image');
             } else {
                 copy($path, $newpath);
                 //Do we need to sharpen the image?
                 $sharpen = false;
                 $info = getimagesize($path);
                 $width_src = $info[0];
                 $height_src = $info[1];
                 $r = $width * $height / ($width_src * $height_src);
                 //r is for ratio
                 if ($r >= 0.5) {
                     $sharpen = false;
                 }
                 if ($this->get_crop_style() == "fit") {
                     $success = resize_image($newpath, $width, $height, $sharpen);
                 } elseif ($this->get_crop_style() == "fill") {
                     $success = crop_image($width, $height, $path, $newpath, $sharpen);
                 }
                 if ($this->do_blit) {
                     //	blit_image($source,$dest,$watermark,$options=array())
                     blit_image($newpath, $newpath, $this->blit_file, $this->blit_options);
                 }
                 clearstatcache();
                 $perms = substr(sprintf('%o', fileperms($path)), -4);
                 $newperms = substr(sprintf('%o', fileperms($newpath)), -4);
                 if ($perms != $newperms) {
                     @chmod($newpath, octdec($perms));
                 }
                 return true;
             }
             return true;
         } else {
             trigger_error('reasonSizedImage class cannot write images to ' . $this->get_image_dir() . $entity->id());
         }
     }
     return false;
 }
コード例 #8
0
ファイル: ItemsController.php プロジェクト: grepollo/dkb_5sp
    public function uploadImage($id, Request $request)
    {
        $x = mysql_real_escape_string(trim($_POST['x']));
        $y = mysql_real_escape_string(trim($_POST['y']));
        $w = mysql_real_escape_string(trim($_POST['w']));
        $h = mysql_real_escape_string(trim($_POST['h']));
        $img_file = trim($_POST['img_file']);
        $errormsg = array();
        if (empty($errormsg)) {
            $sql = 'insert into data set
					item_id="' . $iid . '",
					person_id = "' . $_SESSION['user']['id'] . '",
					created = now()
					';
            mysql_query($sql);
            $last_item_id = mysql_insert_id();
            if ($last_item_id > 0) {
                $i_desti = '../assets/uploads/Image' . $last_item_id . '.jpg';
                $i_desti_2 = '../assets/uploads/itemShort' . $last_item_id . '.png';
                $i_desti_3 = '../assets/uploads/short' . $last_item_id . '.png';
                $media = 'Image' . $last_item_id . '.jpg';
                crop_image($img_file, $i_desti, $x, $y, $w, $h);
                crop_image($img_file, $i_desti_2, $x, $y, $w, $h);
                crop_image($img_file, $i_desti_3, $x, $y, $w, $h);
                $sql = 'update data set media="' . $media . '" WHERE id="' . $last_item_id . '"';
                mysql_query($sql);
            }
            echo 'ok';
            exit;
        }
        echo $errormsg[0];
        exit;
    }
コード例 #9
0
ファイル: Elvis.php プロジェクト: stephenx99/SocialAfrica
 function upload_image($image_object, $is_main_icon)
 {
     if ($image_object['name']) {
         if ($image_object['type'] == "image/gif" || $image_object['type'] == "image/jpeg" || $image_object['type'] == "image/pjpeg" || $image_object['type'] == "image/x-png" || $image_object['type'] == "image/png") {
             if ($image_object["size"] <= 1024000) {
                 // check for error
                 if ($image_object["error"] > 0) {
                     echo "Error: " . $image_object["error"] . "<br />";
                 } else {
                     // set file names
                     $image_name_path = $GLOBALS['path'] . $GLOBALS['image_name'];
                     $main_icon_name_path = $GLOBALS['path'] . $GLOBALS['main_icon_name'];
                     $path = $GLOBALS['path'];
                     // save file
                     move_uploaded_file($image_object['tmp_name'], $image_name_path) or die("Unable to save file.");
                     //--------------------------------------------------------------------------------------------------------
                     // resize main photo
                     resize_main_photo($image_name_path, 400);
                     // resize main icon
                     resize_main_icon($image_name_path, $main_icon_name_path, 260);
                     // crop main icon
                     crop_image($main_icon_name_path, 0, 0, 260, 130, NULL);
                     // crop photo icon
                     crop_image($main_icon_name_path, 55, 20, 90, 70, $path . $GLOBALS['photo_icon_name']);
                     // delete non main icons
                     if ($is_main_icon == false) {
                         unlink($main_icon_name_path);
                     }
                     return true;
                 }
             } else {
                 echo "File size too big.<br />";
             }
         } else {
             echo "Invalid file type.<br />";
         }
     } else {
         //echo "No image uploaded.<br /><br />";
         return false;
     }
 }
コード例 #10
0
ファイル: utillib.php プロジェクト: uniteddiversity/LiteMap
/**
 * Upload an image and place in current user's uploads folder.
 * checking it's actually an image and get it resized to default image size
 * on success return file name;
 * of failure return empty string. Error message go inot $error passed in.
 *
 * @param string $field
 * @param array $errors
 * @return filename or empty string
 */
function uploadImageToFit($field, &$errors, $directory = "")
{
    global $CFG, $USER, $LNG, $HUB_FLM;
    if ($directory == "") {
        if (!isset($USER->userid)) {
            array_push($errors, $LNG->CORE_UNKNOWN_USER_ERROR);
            return "";
        } else {
            $directory = $USER->userid;
        }
    }
    if ($_FILES[$field]['tmp_name'] != "") {
        $target_path = $HUB_FLM->createUploadsDirPath($directory . "/");
        if (!file_exists($target_path)) {
            mkdir($target_path, 0777, true);
        }
        //$dt = time();
        //replace any non alphanum chars in filename
        //should warn user about the file type Gary 2009. 01. 13
        //$t_filename = $dt ."_". basename( preg_replace('/([^A-Za-z0-9.])/i', '',$_FILES[$field]['name']));
        $t_filename = basename(preg_replace('/([^A-Za-z0-9.])/i', '', $_FILES[$field]['name']));
        //echo "t-filename: " . $t_filename;
        //replace the filetype with png (as the resize image code makes everything a png)
        $filename = preg_replace('/(.[B|b][m|M][p|P]$)/i', '.png', $t_filename);
        $filename = preg_replace('/(.[G|g][i|I][f|F]$)/i', '.png', $t_filename);
        $filename = preg_replace('/(.[J|j][p|P][g|G]$)/i', '.png', $t_filename);
        $filename = preg_replace('/(.[J|j][p|P][e|E][g|G]$)/i', '.png', $t_filename);
        //echo "filename: ".$filename;
        //exit();
        $target_path = $target_path . $filename;
        if (!getimagesize($_FILES[$field]['tmp_name'])) {
            array_push($errors, $LNG->CORE_NOT_IMAGE_ERROR);
            return "";
        } else {
            if (filesize($_FILES[$field]['tmp_name']) > $CFG->IMAGE_MAX_FILESIZE) {
                array_push($errors, $LNG->CORE_NOT_IMAGE_TOO_LARGE_ERROR);
                return "";
            } else {
                if (!move_uploaded_file($_FILES[$field]['tmp_name'], $target_path)) {
                    array_push($errors, $LNG->CORE_NOT_IMAGE_UPLOAD_ERROR);
                    return "";
                }
            }
        }
        $imageinfo = getimagesize($target_path);
        $width = $imageinfo[0];
        $height = $imageinfo[1];
        //scale
        if ($width > $CFG->IMAGE_WIDTH || $height > $CFG->IMAGE_HEIGHT) {
            $new_width = floatval($CFG->IMAGE_WIDTH);
            $new_height = $height * ($new_width / $width);
            if ($new_height < $CFG->IMAGE_HEIGHT) {
                $new_height = floatval($CFG->IMAGE_HEIGHT);
                $new_width = $width * ($new_height / $height);
                if ($new_width >= $CFG->IMAGE_WIDTH) {
                    if (!resize_image($target_path, $target_path, $CFG->IMAGE_HEIGHT)) {
                        //delete the file, it could be dodgy
                        unlink($target_path);
                        array_push($errors, $LNG->CORE_NOT_IMAGE_RESIZE_ERROR);
                        return "";
                    }
                }
            } else {
                if (!resize_image($target_path, $target_path, $CFG->IMAGE_WIDTH)) {
                    //delete the file, it could be dodgy
                    unlink($target_path);
                    array_push($errors, $LNG->CORE_NOT_IMAGE_RESIZE_ERROR);
                    return "";
                }
            }
        }
        $imageinfo = getimagesize($target_path);
        $width = $imageinfo[0];
        $height = $imageinfo[1];
        //error_log($width);
        //error_log($height);
        if ($width < $CFG->IMAGE_WIDTH || $height < $CFG->IMAGE_HEIGHT) {
            if (!image_scale_up($target_path, $target_path, $CFG->IMAGE_WIDTH, $CFG->IMAGE_HEIGHT)) {
                //delete the file, it could be dodgy
                unlink($target_path);
                array_push($errors, $LNG->CORE_NOT_IMAGE_RESIZE_ERROR);
                return "";
            }
        } else {
            if ($width > $CFG->IMAGE_WIDTH || $height > $CFG->IMAGE_HEIGHT) {
                if (!crop_image($target_path, $target_path, 0, 0, $CFG->IMAGE_WIDTH, $CFG->IMAGE_HEIGHT)) {
                    //delete the file, it could be dodgy
                    unlink($target_path);
                    array_push($errors, $LNG->CORE_NOT_IMAGE_RESIZE_ERROR);
                    return "";
                }
            }
        }
        if (!create_image_thumb($filename, $CFG->IMAGE_THUMB_WIDTH, $directory)) {
            //delete the file, it could be dodgy
            unlink($target_path);
            array_push($errors, $LNG->CORE_NOT_IMAGE_SCALE_ERROR);
            return "";
        }
        return $filename;
    }
    return "";
}
コード例 #11
0
 /**
  * displayImage
  *
  * displays a file as an image and then exits
  *
  * @param string $path
  * @param int/bool $width
  * @param int/bool $height
  * @return void
  */
 public function displayImage($path, $width = false, $height = false)
 {
     /**
      * permission check
      */
     if (!$this->hasPerm($path, 'v')) {
         return false;
     }
     // temporary - might move this functionality entirely
     // into the file manager
     require_once HOME . '_inc/function/files.php';
     // create WBMP
     $file = $this->getFile($path);
     switch ($file['type']) {
         case 'image/png':
             $image = imagecreatefrompng($this->users_files . $path);
             break;
         case 'image/jpeg':
         case 'image/jpg':
         case 'image/JPG':
         case 'image/JPEG':
             $image = imagecreatefromjpeg($this->users_files . $path);
             break;
         case 'image/gif':
             $image = imagecreatefromgif($this->users_files . $path);
             break;
         default:
             return $this->setError(15, $path);
     }
     if ($width != false && $height != false) {
         // crop WBMP
         $image = crop_image($image, $width, $height, true, $this->users_files . $path);
     } else {
         if ($width != false) {
             // resize WBMP
             $image = resize_image($image, $width, false, true, $this->users_files . $path);
         }
     }
     // display WBMP as png
     header('Content-Type: image/png');
     imagepng($image);
     imagedestroy($image);
     exit;
 }
コード例 #12
0
 public function saveAvatar()
 {
     if (isLogin()) {
         if (IS_POST && !empty($_POST['imgSrc'])) {
             if ($_POST['postStatus'] == 0) {
                 $user = session('user_name') ? session('user_name') : cookie('user_name');
                 $avatar = crop_image($_POST['imgSrc'], $_POST['pw'], $_POST['ph'], $_POST['cw'], $_POST['ch'], $_POST['x'], $_POST['y'], 100, 100, 'avatar', null, $user);
                 $avatarMini = crop_image($_POST['imgSrc'], $_POST['miniw'], $_POST['minih'], $_POST['cw'], $_POST['ch'], $_POST['x'], $_POST['y'], 60, 90, 'avatar', null, $user . '-mini');
                 if ($avatar != false && $avatarMini != false) {
                     $d['user_avatar'] = $avatar;
                     $d['user_avatar_mini'] = $avatarMini;
                     if ($this->user->where(array('user_name' => get_now_user()))->save($d) === false) {
                         $this->ajaxReturn(array('status' => 'error', 'errorType' => 'saveFail', 'Info' => '图片保存失败,请重试!'));
                     } else {
                         $this->ajaxReturn(array('status' => 'success', 'Info' => '图片保存成功。'));
                     }
                 } else {
                     $this->ajaxReturn(array('status' => 'error', 'errorType' => 'missImage', 'Info' => '图片已丢失。请重试'));
                 }
             } else {
                 $this->ajaxReturn(array('status' => 'error', 'errorType' => 'RepeatUpload', 'Info' => '请重新选择图片。'));
             }
         } else {
             $this->ajaxReturn(array('status' => 'error', 'errorType' => 'NotUploaded', 'Info' => '请选择图片。'));
         }
     } else {
         $this->error('请先登录', '/login');
     }
 }
コード例 #13
0
ファイル: upload.php プロジェクト: Emaren/agentpage
function createThumb($str_image_src, $ext, $suffix, $int_new_width, $int_new_height, $sql, $fid)
{
    if ($ext == "jpg") {
        $res_src_image = imagecreatefromjpeg($str_image_src);
    } elseif ($ext == "png") {
        $res_src_image = imagecreatefrompng($str_image_src);
    } elseif ($ext == "gif") {
        $res_src_image = imagecreatefromgif($str_image_src);
    }
    $str_image_dest = basename($str_image_src);
    $str_image_dest = realpath('.') . '\\images\\' . substr($str_image_dest, 0, strrpos($str_image_dest, '.')) . $suffix . '.jpg';
    $int_new_height_tmp = get_image_height($res_src_image, $int_new_width);
    $res_dst_image = imagecreatetruecolor($int_new_width, $int_new_height);
    // Check proportions are the same.
    if ($int_new_height / $int_new_width == imageSY($res_src_image) / imageSX($res_src_image)) {
        // Resize Image
        imagecopyresampled($res_dst_image, $res_src_image, 0, 0, 0, 0, $int_new_width, $int_new_height, imagesx($res_src_image), imagesy($res_src_image));
    } else {
        // Scale Image
        $res_scaled_image = scale_image(&$res_src_image, $int_new_width, $int_new_height);
        // Crop Image
        crop_image(&$res_dst_image, &$res_scaled_image, $int_new_width, $int_new_height);
    }
    imagejpeg($res_dst_image, $str_image_dest);
    global $nooutput;
    if ($nooutput == '' or !isset($nooutput)) {
        if (!isset($_SESSION["file_info"])) {
            $_SESSION["file_info"] = array();
        }
        ob_end_clean();
        ob_start();
        imagejpeg($res_dst_image);
        $imagevariable = ob_get_contents();
        ob_end_clean();
        $file_id = md5($_FILES["Filedata"]["tmp_name"] + rand() * 100000);
        $_SESSION["file_info"][$file_id] = $imagevariable;
        echo "FILEID:" . $file_id . "\n";
        // Return the file id to the script
        echo "FID:" . $fid;
        return $res_dst_image;
    }
}
コード例 #14
0
ファイル: mn-profile.php プロジェクト: deanbrabec/news_slider
 $avatar_file = './' . $dir['avatars'] . $avatar_name . '-source.' . $avatar_ext;
 move_uploaded_file($_FILES['avatar']['tmp_name'], $avatar_file);
 list($avatar_width, $avatar_height) = getimagesize($avatar_file);
 if (isset($avatar_width) && !empty($avatar_width) && isset($avatar_height) && !empty($avatar_height)) {
     if (isset($var['avatar']) && !empty($var['avatar'])) {
         list($old_avatar_file, $old_avatar_ext, $old_avatar_width, $old_avatar_height) = explode(';', $var['avatar']);
         if (file_exists('./' . $dir['avatars'] . $old_avatar_file . '.' . $old_avatar_ext)) {
             unlink('./' . $dir['avatars'] . $old_avatar_file . '.' . $old_avatar_ext);
             unlink('./' . $dir['avatars'] . $old_avatar_file . '-small.' . $old_avatar_ext);
             unlink('./' . $dir['avatars'] . $old_avatar_file . '-mini.' . $old_avatar_ext);
         }
     }
     $standard_size = isset($conf['users_avatar_standard']) && is_numeric($conf['users_avatar_standard']) ? $conf['users_avatar_standard'] : $default['avatar_size_standard'];
     $small_size = isset($conf['users_avatar_small']) && is_numeric($conf['users_avatar_small']) ? $conf['users_avatar_small'] : $default['avatar_size_small'];
     $mini_size = isset($conf['users_avatar_mini']) && is_numeric($conf['users_avatar_mini']) ? $conf['users_avatar_mini'] : $default['avatar_size_mini'];
     crop_image($avatar_file, $avatar_file);
     resize_img($avatar_file, $standard_size, './' . $dir['avatars'] . $avatar_name . '.' . $avatar_ext);
     resize_img($avatar_file, $small_size, './' . $dir['avatars'] . $avatar_name . '-small.' . $avatar_ext);
     resize_img($avatar_file, $mini_size, './' . $dir['avatars'] . $avatar_name . '-mini.' . $avatar_ext);
     unlink($avatar_file);
     list($avatar_width, $avatar_height) = getimagesize('./' . $dir['avatars'] . $avatar_name . '.' . $avatar_ext);
     $avatar_info = $avatar_name . ';' . $avatar_ext . ';' . $avatar_width . ';' . $avatar_height;
     $user_line = $var['user_id'] . DELIMITER . $var['username'] . DELIMITER . $var['pass'] . DELIMITER . $var['email'] . DELIMITER . $var['group'] . DELIMITER . $var['status'] . DELIMITER . $var['key'] . DELIMITER . $var['last_login'] . DELIMITER . $var['last_ip'] . DELIMITER . $var['registered'] . DELIMITER . $var['registered_ip'] . DELIMITER . $var['public_email'] . DELIMITER . '' . DELIMITER . '' . DELIMITER . '' . DELIMITER . '' . DELIMITER . '' . DELIMITER . '' . DELIMITER . '' . DELIMITER . $avatar_info . DELIMITER . $var['nickname'] . DELIMITER . $var['gender'] . DELIMITER . $var['birthdate'] . DELIMITER . $var['location'] . DELIMITER . $var['www'] . DELIMITER . $var['icq'] . DELIMITER . $var['msn'] . DELIMITER . $var['skype'] . DELIMITER . $var['jabber'] . DELIMITER . '' . DELIMITER . '' . DELIMITER . $var['other1'] . DELIMITER . $var['other2'] . DELIMITER . trim($var['about']) . "\n";
     $u_file = file($file['users']);
     $u_content = '';
     foreach ($u_file as $u_line) {
         $u_data = explode(DELIMITER, $u_line);
         if ($uid == $u_data[0]) {
             $u_content .= $user_line;
         } else {
             $u_content .= $u_line;
コード例 #15
0
 public function album()
 {
     $info = $this->upload();
     if ($info['path']) {
         $data['path'] = $info['path'];
         crop_image($info['path']);
         crop_image($info['path'], 360, 270);
         //                crop_secret($info['path'],720,540);
         crop_secret($info['path'], 360, 270);
         //                $data['secret_pic']=$data['thumb_360'];
         $this->apiSuccess('success', $data);
     }
     $this->apiError(0, '上传失败');
 }