• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP vB_Image类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中vB_Image的典型用法代码示例。如果您正苦于以下问题:PHP vB_Image类的具体用法?PHP vB_Image怎么用?PHP vB_Image使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了vB_Image类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: pre_save

 function pre_save($doquery = true)
 {
     if ($this->presave_called !== null) {
         return $this->presave_called;
     }
     if ($file =& $this->fetch_field('filedata')) {
         $this->setr_info('filedata', $file);
         $this->do_unset('filedata');
         $this->set('filesize', strlen($this->info['filedata']));
         chdir(DIR);
         if (!is_writable($this->filepath)) {
             $this->error('upload_invalid_imagepath');
             return false;
         }
         if ($thumb =& $this->fetch_field('filedata_thumb')) {
             $this->setr_info('filedata_thumb', $thumb);
             $this->do_unset('filedata_thumb');
         }
         $image =& vB_Image::instance();
     }
     return parent::pre_save($doquery);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:22,代码来源:filesystem.php


示例2: fetchChannelIcon

 /**
  * Get a blog icon
  *
  * @param  int    The channel or nodeid
  * @param  string Thumbnail version/size requested (SIZE_* constanst in vB_Api_Filedata)
  *
  * @return mixed  the raw content of the image.
  */
 function fetchChannelIcon($nodeid, $type = vB_Api_Filedata::SIZE_FULL)
 {
     if (!vB::getUserContext()->getChannelPermission('forumpermissions', 'canview', $nodeid)) {
         return $this->getDefaultChannelIcon($nodeid);
     }
     $channel = $this->assertor->getRow('vBForum:channel', array('nodeid' => $nodeid));
     if ($channel['filedataid']) {
         $params = array('filedataid' => $channel['filedataid'], 'type' => $type);
         $record = vB::getDbAssertor()->getRow('vBForum:getFiledataContent', $params);
         if (!empty($record)) {
             return vB_Image::instance()->loadFileData($record, $type, true);
         }
     }
     //If we don't have a valid custom icon, return the default.
     return $this->getDefaultChannelIcon($nodeid);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:24,代码来源:channel.php


示例3: header

            $db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "humanverify\n\t\t\tSET viewed = 1\n\t\t\tWHERE hash = '" . $db->escape_string($vbulletin->GPC['hash']) . "' AND\n\t\t\t\tviewed = 0\n\t\t");
            if ($db->affected_rows() == 0) {
                // image managed to get viewed by someone else between the $imageinfo query above and now
                header('Content-type: image/gif');
                readfile(DIR . '/' . $vbulletin->options['cleargifurl']);
                exit;
            }
        }
    }
    if ($vbulletin->GPC['i'] == 'gd') {
        $image = new vB_Image_GD($vbulletin);
    } else {
        if ($vbulletin->GPC['i'] == 'im') {
            $image = new vB_Image_Magick($vbulletin);
        } else {
            $image =& vB_Image::fetch_library($vbulletin, 'regimage');
        }
    }
    $db->close();
    $image->print_image_from_string($imageinfo['answer'], $moveabout);
} else {
    if ($vbulletin->GPC['userid']) {
        $vbulletin->input->clean_array_gpc('r', array('dateline' => TYPE_UINT));
        $filedata = 'filedata';
        if ($vbulletin->GPC['type'] == 'profile') {
            $table = 'customprofilepic';
            $can_view_profile_pic = ($vbulletin->options['profilepicenabled'] and ($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseeprofilepic'] or $vbulletin->userinfo['userid'] == $vbulletin->GPC['userid']));
            if ($can_view_profile_pic) {
                require_once DIR . '/includes/functions_user.php';
                if (!can_view_profile_section($vbulletin->GPC['userid'], 'profile_picture')) {
                    $can_view_profile_pic = false;
开发者ID:0hyeah,项目名称:yurivn,代码行数:31,代码来源:image.php


示例4: attach_image

function attach_image ($file_name, $filedirectory, $nodeid)
{
	global $vbulletin;
	//make a copy of the file, the attachment code assumes its a temp file and deletes it.

	$file_location = "$filedirectory/$file_name";
	if (!$file_name OR !file_exists($file_location))
	{
		echo "<p>Could not find file $file_location\n";
		exit;
	}

	if ($vbulletin->options['safeupload'])
	{
		$temp_name = $vbulletin->options['tmppath'] . '/vbupload-install-' . substr(TIMENOW, -4);
	}
	else
	{
		$temp_name = @tempnam(ini_get('upload_tmp_dir'), 'vbupload');
	}

	if (!copy($file_location, $temp_name))
	{
		echo "<p>Could not make temporary copy of image in $temp_name</p>";
		exit;
	}

	//need to clear the cache so that the filesize operation works below.
	clearstatcache();

	$attachment = array(
		'name'     => $file_name,
		'tmp_name' => $temp_name,
		'error'    => array(),
		'size'     => filesize($temp_name)
	);

	$poststarttime = time();
	$posthash = md5($vbulletin->GPC['poststarttime'] . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt']);

	$contenttypeid = vB_Types::instance()->getContentTypeId("vBCms_Article");

	// here we call the attach/file data combined dm
	$attachdata =& datamanager_init('AttachmentFiledata', $vbulletin, ERRTYPE_ARRAY, 'attachment');
	$attachdata->set('contenttypeid', $contenttypeid);
	$attachdata->set('posthash', $posthash);
	$attachdata->set('contentid', $nodeid);
	$attachdata->set_info('categoryid', 0);
	$attachdata->set('state', 'visible');

	$upload = new vB_Upload_Attachment_Backend($vbulletin);
	$upload->contenttypeid = $contenttypeid;
	$upload->userinfo = $vbulletin->userinfo;
	$upload->data =& $attachdata;
	$upload->image =& vB_Image::fetch_library($vbulletin);

	$attachmentid = $upload->process_upload($attachment);
	if(!$attachmentid)
	{
		echo "<p>Error loading image '$file_name':" . $upload->error . "</p>";
	}
	return $attachmentid;
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:63,代码来源:default_data_functions.php


示例5: pre_save

	/**
	* Any checks to run immediately before saving. If returning false, the save will not take place.
	*
	* @access protected
	*
	* @param boolean $doquery					Do the query?
	* @return boolean							True on success; false if an error occurred
	*/
	function pre_save($doquery = true)
	{
		if ($this->presave_called !== null)
		{
			return $this->presave_called;
		}

		if ($file =& $this->fetch_field('filedata'))
		{
			$this->setr_info('filedata', $file);
			$this->do_unset('filedata');

			if (!is_writable($this->fetch_path($this->fetch_field('groupid'), $this->info['group']['icondateline'], false, true)))
			{
				$this->error('upload_invalid_imagepath');
				return false;
			}

			if ($thumb =& $this->fetch_field('thumbnail_filedata'))
			{
				$this->setr_info('thumbnail_filedata', $thumb);
				$this->do_unset('thumbnail_filedata');
			}

			require_once(DIR . '/includes/class_image.php');
			$image =& vB_Image::fetch_library($this->registry);
		}

		return parent::pre_save($doquery);
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:38,代码来源:class_dm_socialgroupicon.php


示例6: do_upload_avatar

function do_upload_avatar()
{
    global $vbulletin, $db, $show, $vbphrase, $permissions;
    if (!($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canmodifyprofile'])) {
        print_no_permission();
    }
    if (!$vbulletin->options['avatarenabled']) {
        standard_error(fetch_error('avatardisabled'));
    }
    if ($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar']) {
        $vbulletin->input->clean_gpc('f', 'upload', TYPE_FILE);
        // begin custom avatar code
        require_once DIR . '/includes/class_upload.php';
        require_once DIR . '/includes/class_image.php';
        $upload = new vB_Upload_Userpic($vbulletin);
        $upload->data =& datamanager_init('Userpic_Avatar', $vbulletin, ERRTYPE_STANDARD, 'userpic');
        $upload->image =& vB_Image::fetch_library($vbulletin);
        $upload->maxwidth = $vbulletin->userinfo['permissions']['avatarmaxwidth'];
        $upload->maxheight = $vbulletin->userinfo['permissions']['avatarmaxheight'];
        $upload->maxuploadsize = $vbulletin->userinfo['permissions']['avatarmaxsize'];
        $upload->allowanimation = $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cananimateavatar'] ? true : false;
        if (!$upload->process_upload($vbulletin->GPC['avatarurl'])) {
            standard_error($upload->fetch_error());
        }
    }
    // init user data manager
    $userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
    $userdata->set_existing($vbulletin->userinfo);
    $userdata->set('avatarid', 0);
    ($hook = vBulletinHook::fetch_hook('profile_updateavatar_complete')) ? eval($hook) : false;
    $userdata->save();
    return array('success' => true);
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:33,代码来源:profile.php


示例7: pre_save

 function pre_save($doquery = true)
 {
     if ($this->presave_called !== null) {
         return $this->presave_called;
     }
     if ($file =& $this->fetch_field('filedata')) {
         $this->setr_info('filedata', $file);
         $this->do_unset('filedata');
         $this->set('filesize', strlen($this->info['filedata']));
         if (!is_writable($this->filepath)) {
             $this->error('upload_invalid_imagepath');
             return false;
         }
         if ($thumb =& $this->fetch_field('filedata_thumb')) {
             $this->setr_info('filedata_thumb', $thumb);
             $this->do_unset('filedata_thumb');
         }
         require_once DIR . '/includes/class_image.php';
         $image =& vB_Image::fetch_library($this->registry);
     }
     return parent::pre_save($doquery);
 }
开发者ID:holandacz,项目名称:nb4,代码行数:22,代码来源:class_dm_userpic.php


示例8: updateAvatar

 /**
  * Update avatar
  *
  * @param integer $userid User ID whose avatar is going to be updated
  * @param integer $avatarid Predefined avatar ID. -1 means to remove avatar
  *				from the user. 0 means use custom avatar defined in $avatardata
  * @param array $data Avatar data. It should be an array contains
  *			  the following items: 'filename', 'width', 'height', 'filedata', 'location'
  */
 public function updateAvatar($userid, $avatarid, $data = array(), $cropped = false)
 {
     $userContext = vB::getUserContext();
     $currentUserId = $userContext->fetchUserId();
     $userid = intval($userid);
     if ($userid <= 0 and $currentUserId) {
         $userid = $currentUserId;
     }
     // Check if current user canadminusers
     try {
         $this->checkHasAdminPermission('canadminusers');
     } catch (Exception $e) {
         // No. Then we need to do something here.
         if ($currentUserId != $userid) {
             // If current user isn't the same as passed $userid
             throw new vB_Exception_Api('no_permission');
         }
     }
     $useavatar = $avatarid == -1 ? 0 : 1;
     $bf_ugp_genericpermissions = vB::getDatastore()->getValue('bf_ugp_genericpermissions');
     $userinfo = vB_User::fetchUserInfo(intval($userid));
     if (!$userinfo) {
         throw new vB_Exception_Api('invalid_user_specified');
     }
     // init user datamanager
     $userdata = new vB_Datamanager_User(vB_DataManager_Constants::ERRTYPE_ARRAY_UNPROCESSED);
     $userdata->set_existing($userinfo);
     if ($useavatar) {
         if (!$avatarid) {
             $userpic = new vB_DataManager_Userpic(vB_DataManager_Constants::ERRTYPE_ARRAY_UNPROCESSED);
             // user's group doesn't have permission to use custom avatars so set override
             if (!$this->userContext->hasPermission('genericpermissions', 'canuseavatar')) {
                 // init user datamanager
                 $userdata->set_bitfield('adminoptions', 'adminavatar', 1);
             }
             $userpic->set('userid', $userinfo['userid']);
             $userpic->set('dateline', vB::getRequest()->getTimeNow());
             $userpic->set('width', $data['width']);
             $userpic->set('height', $data['height']);
             if (empty($data['extension'])) {
                 $filebits = explode('.', $data['filename']);
                 $data['extension'] = end($filebits);
             }
             $userpic->set('extension', $data['extension']);
             if (vB::getDatastore()->getOption('usefileavatar')) {
                 $avatarpath = vB::getDatastore()->getOption('avatarpath');
                 $prev_dir = getcwd();
                 chdir(DIR);
                 $oldavatarfilename = "avatar{$userid}_{$userinfo['avatarrevision']}.{$data['extension']}";
                 $avatarrevision = $userinfo['avatarrevision'] + 1;
                 $avatarfilename = "avatar{$userid}_{$avatarrevision}.{$data['extension']}";
                 @unlink($avatarpath . '/' . $oldavatarfilename);
                 @unlink($avatarpath . '/thumbs/' . $oldavatarfilename);
                 $avatarres = @fopen("{$avatarpath}/{$avatarfilename}", 'wb');
                 $userpic->set('filename', $avatarfilename);
                 fwrite($avatarres, $data['filedata']);
                 @fclose($avatarres);
                 if (!empty($data['filedata_thumb'])) {
                     $thumbres = @fopen("{$avatarpath}/thumbs/{$avatarfilename}", 'wb');
                     fwrite($thumbres, $data['filedata_thumb']);
                     @fclose($thumbres);
                     $userpic->set('width_thumb', $data['width_thumb']);
                     $userpic->set('height_thumb', $data['height_thumb']);
                 }
                 chdir($prev_dir);
                 $userpic->set('filesize', $data['filesize']);
                 $userdata->set('avatarrevision', $userinfo['avatarrevision'] + 1);
             } else {
                 $avatarfilename = "avatar{$userid}_{$userinfo['avatarrevision']}.{$data['extension']}";
                 $userpic->setr('filedata', $data['filedata']);
                 $userpic->set('filename', $avatarfilename);
                 $imageHandler = vB_Image::instance();
                 if (!$cropped) {
                     $thumb = $imageHandler->fetchThumbNail($data['name'], $data['location']);
                 }
                 if (!$cropped) {
                     $userpic->set('filedata_thumb', $thumb['filedata']);
                     $userpic->set('width_thumb', $thumb['width']);
                     $userpic->set('height_thumb', $thumb['height']);
                 } else {
                     $userpic->set('filedata_thumb', $data['filedata_thumb']);
                     $userpic->set('width_thumb', $data['width_thumb']);
                     $userpic->set('height_thumb', $data['height_thumb']);
                 }
             }
             $userpic->save();
         } else {
             // predefined avatar
             $userpic = new vB_DataManager_Userpic_Avatar(vB_DataManager_Constants::ERRTYPE_ARRAY_UNPROCESSED);
             $userpic->condition = array('userid' => $userinfo['userid']);
             $userpic->delete();
//.........这里部分代码省略.........
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:101,代码来源:user.php


示例9: __construct

 protected function __construct()
 {
     parent::__construct();
     $this->imageHandler = vB_Image::instance();
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:5,代码来源:attach.php


示例10: save_fbavatar

/**
* Saves the facebook avatar specified from facebook url
*
* @param	vB_DataManager_User, the datamanager to put any upload errors into
* @param	string,	the url to retrieve the avatar from
* @param	bool, flag denoting if we want to try a different URL if this one fails
* @param	string,	the url to retrieve the avatar from if the first one fails
*
* @return	bool	true if saved worked, false otherwise
*/
function save_fbavatar($userdata, $avatarurl = '', $do_fallback = true, $fallback_avatarurl = '')
{
    global $vbulletin;
    // if we are not passed an avatar url, grab it from fb api
    if (empty($avatarurl)) {
        $pf = get_vbprofileinfo();
        $avatarurl = $pf['avatarurl'];
    }
    // begin custom avatar code
    require_once DIR . '/includes/class_upload.php';
    require_once DIR . '/includes/class_image.php';
    // grab permissions info from logged in user, if user not logged in, use permissions from registered usergroup
    $usergroup_info = !empty($vbulletin->userinfo['userid']) ? $vbulletin->userinfo['permissions'] : $vbulletin->usergroupcache[2];
    // if user does not have permission to user custom avatar, skip this step
    if (!($usergroup_info['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar'])) {
        return;
    }
    // initialize the uploader and populate with the avatar permissions
    $upload = new vB_Upload_Userpic($vbulletin);
    $upload->data =& datamanager_init('Userpic_Avatar', $vbulletin, ERRTYPE_STANDARD, 'userpic');
    $upload->image =& vB_Image::fetch_library($vbulletin);
    $upload->maxwidth = $usergroup_info['avatarmaxwidth'];
    $upload->maxheight = $usergroup_info['avatarmaxheight'];
    $upload->maxuploadsize = $usergroup_info['avatarmaxsize'];
    $upload->allowanimation = $usergroup_info['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cananimateavatar'] ? true : false;
    // upload and validate
    if (!$upload->process_upload($avatarurl)) {
        // check if we want to try a fallback url
        if ($do_fallback) {
            // if we are not passed a fallback url, grab smaller pic from FB api
            if (empty($fallback_avatarurl)) {
                $pf = get_vbprofileinfo();
                $fallback_avatarurl = $pf['fallback_avatarurl'];
            }
            // do this again, but don't use a fallback if that one fails
            return save_fbavatar($userdata, $fallback_avatarurl, false);
        } else {
            $userdata->error($upload->fetch_error());
            return false;
        }
    }
    // if we get here, there were no errors, so return true
    return true;
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:54,代码来源:functions_facebook.php


示例11: max

		'perpage'      => TYPE_UINT,
		'startat'      => TYPE_UINT
	));

	// Increase memlimit
	if (($memory_limit = ini_size_to_bytes(@ini_get('memory_limit'))) < 128 * 1024 * 1024 AND $memory_limit > 0)
	{
		@ini_set('memory_limit', 128 * 1024 * 1024);
	}

	// Get dimension constants
	require_once(DIR . '/includes/functions_socialgroup.php');

	// Get image handler
	require_once(DIR . '/includes/class_image.php');
	$image = vB_Image::fetch_library($vbulletin);

	// Check if image manip is supported
	if ($vbulletin->options['imagetype'] != 'Magick' AND !function_exists('imagetypes'))
	{
		print_stop_message('your_version_no_image_support');
	}

	$vbulletin->GPC['perpage'] = max($vbulletin->GPC['perpage'], 20);

	echo '<p>' . construct_phrase($vbphrase['building_sgicon_thumbnails'], "misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=rebuildsgicons&startat=" . $vbulletin->GPC['startat'] . "&pp=" . $vbulletin->GPC['perpage'] . "&autoredirect=" . $vbulletin->GPC['autoredirect'] . "&quality=" . $vbulletin->GPC['quality']) . '</p>';

	// Get group info
	$result = $vbulletin->db->query_read("
		SELECT socialgroupicon.dateline, socialgroupicon.userid, socialgroupicon.filedata, socialgroupicon.extension,
				socialgroupicon.width, socialgroupicon.height, socialgroupicon.groupid
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:misc.php


示例12: uploadAvatar

 public function uploadAvatar($filename, $crop = array(), $userid = false)
 {
     $imageHandler = vB_Image::instance();
     $fileInfo = $imageHandler->fetchImageInfo($filename);
     if (!$fileInfo) {
         throw new vB_Exception_Api('upload_invalid_image');
     }
     if ($userid === false) {
         $userid = vB::getCurrentSession()->get('userid');
     }
     $usercontext = vB::getUserContext($userid);
     $pathinfo = empty($crop['org_file_info']) ? pathinfo($filename) : $crop['org_file_info'];
     $dimensions['src_width'] = $fileInfo[0];
     $dimensions['src_height'] = $fileInfo[1];
     if (empty($crop['width']) and empty($crop['height'])) {
         $crop['width'] = $dimensions['src_width'];
         $crop['height'] = $dimensions['src_height'];
     }
     $crop['width'] = min($crop['width'], $dimensions['src_width']);
     $crop['height'] = min($crop['height'], $dimensions['src_height']);
     // the crop area should be square
     $crop['width'] = $crop['height'] = min($crop['width'], $crop['height']);
     $maxwidth = $usercontext->getLimit('avatarmaxwidth');
     $maxheight = $usercontext->getLimit('avatarmaxheight');
     //see if we need to resize the cropped image (if the crop happened on a resized image)
     $resize_ratio = 1;
     if (!empty($crop['resized_width']) and $crop['resized_width'] < $dimensions['src_width']) {
         $resize_ratio = $dimensions['src_height'] / $crop['resized_height'];
     }
     $dimensions['x1'] = round(empty($crop['x1']) ? 0 : $crop['x1'] * $resize_ratio);
     $dimensions['y1'] = round(empty($crop['y1']) ? 0 : $crop['y1'] * $resize_ratio);
     $dimensions['width'] = round((empty($crop['width']) ? $maxwidth : $crop['width']) * $resize_ratio);
     $dimensions['height'] = round((empty($crop['height']) ? $maxheight : $crop['height']) * $resize_ratio);
     $isCropped = ($dimensions['src_width'] > $dimensions['width'] or $dimensions['src_height'] > $dimensions['height']);
     $ext = strtolower($fileInfo[2]);
     $dimensions['extension'] = empty($ext) ? $pathinfo['extension'] : $ext;
     $dimensions['filename'] = $filename;
     $dimensions['filedata'] = file_get_contents($filename);
     // Check max height and max weight from the usergroup's permissions
     $forceResize = false;
     // force a resize if the uploaded file has the right dimensions but the file size exceeds the limits
     if ($resize_ratio == 1 and !$isCropped and strlen($dimensions['filedata']) > $usercontext->getLimit('avatarmaxsize')) {
         $new_dimensions = $imageHandler->bestResize($dimensions['src_width'], $dimensions['src_height']);
         $crop['width'] = $new_dimensions['width'];
         $crop['height'] = $new_dimensions['height'];
         $forceResize = true;
     }
     $extension_map = $imageHandler->getExtensionMap();
     if ($forceResize or $maxwidth < $fileInfo[0] or $maxheight < $fileInfo[1]) {
         $fileArray_cropped = $imageHandler->cropImg($dimensions, min(empty($crop['width']) ? $maxwidth : $crop['width'], $maxwidth), min(empty($crop['height']) ? $maxheight : $crop['height'], $maxheight), $forceResize);
         //want to get the thumbnail based on the cropped image
         $fh = fopen($filename, 'w');
         fwrite($fh, $fileArray_cropped['filedata']);
         fclose($fh);
         $fileArray_thumb = $imageHandler->fetchThumbnail($pathinfo['basename'], $filename);
         $filearray = array('size' => $fileArray_cropped['filesize'], 'filename' => $filename, 'name' => $pathinfo['filename'], 'location' => $pathinfo['dirname'], 'type' => 'image/' . $extension_map[strtolower($dimensions['extension'])], 'filesize' => $fileArray_cropped['filesize'], 'height' => $fileArray_cropped['height'], 'width' => $fileArray_cropped['width'], 'filedata_thumb' => $fileArray_thumb['filedata'], 'filesize_thumb' => $fileArray_thumb['filesize'], 'height_thumb' => $fileArray_thumb['height'], 'width_thumb' => $fileArray_thumb['width'], 'extension' => $dimensions['extension'], 'filedata' => $fileArray_cropped['filedata']);
     } else {
         $fileArray_thumb = $imageHandler->fetchThumbnail($pathinfo['basename'], $filename);
         $filearray = array('size' => strlen($dimensions['filedata']), 'filename' => $filename, 'name' => $pathinfo['filename'], 'location' => $pathinfo['dirname'], 'type' => 'image/' . $extension_map[strtolower($dimensions['extension'])], 'filesize' => strlen($dimensions['filedata']), 'height' => $fileInfo[1], 'width' => $fileInfo[0], 'filedata_thumb' => $fileArray_thumb['filedata'], 'filesize_thumb' => $fileArray_thumb['filesize'], 'height_thumb' => $fileArray_thumb['source_height'], 'width_thumb' => $fileArray_thumb['source_width'], 'extension' => $dimensions['extension'], 'filedata' => $dimensions['filedata']);
     }
     $api = vB_Api::instanceInternal('user');
     $result = $api->updateAvatar($userid, false, $filearray, true);
     if (empty($result['errors'])) {
         return $api->fetchAvatar($userid);
     } else {
         return $result;
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:68,代码来源:user.php


示例13: fetchHvImage

 /**
  * Fetch Human Verification Image Data
  *
  * @param $hash
  * @return array 'type' => Image type 'data' => Image binary data
  */
 public function fetchHvImage($hash = '')
 {
     $vboptions = vB::getDatastore()->getValue('options');
     $moveabout = true;
     if (!$hash or $hash == 'test' or $vboptions['hv_type'] != 'Image') {
         $imageinfo = array('answer' => 'vBulletin');
         $moveabout = $hash == 'test' ? true : false;
     } else {
         if (!($imageinfo = $this->assertor->getRow('humanverify', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'hash' => $hash, 'viewed' => 0)))) {
             return array('type' => 'gif', 'data' => file_get_contents(DIR . '/' . $vboptions['cleargifurl']));
         } else {
             $this->assertor->assertQuery('humanverify', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'viewed' => 1, vB_dB_Query::CONDITIONS_KEY => array('hash' => $hash, 'viewed' => 0)));
             if ($this->assertor->affected_rows() == 0) {
                 // image managed to get viewed by someone else between the $imageinfo query above and now
                 return array('type' => 'gif', 'data' => file_get_contents(DIR . '/' . $vboptions['cleargifurl']));
             }
         }
     }
     $image = vB_Image::instance();
     $imageInfo = $image->getImageFromString($imageinfo['answer'], $moveabout);
     return array('type' => $imageInfo['filetype'], 'data' => $imageInfo['filedata']);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:28,代码来源:hv.php


示例14: fetchImageByLinkId

 /**
  * This returns a link image by nodeid
  *
  * @param  int    Node ID
  * @param  string Thumbnail version/size requested (SIZE_* constanst in vB_Api_Filedata)
  *
  * @return mixed  Array of filedataid,filesize, extension, filedata, htmltype.
  */
 public function fetchImageByLinkId($linkid, $type = vB_Api_Filedata::SIZE_FULL)
 {
     $link = $this->getContent($linkid);
     $link = $link[$linkid];
     if (empty($link)) {
         return array();
     }
     //First validate permission.
     if ($link['userid'] != vB::getUserContext()->fetchUserId()) {
         if (!$link['showpublished']) {
             if (!vB::getUserContext()->hasChannelPermission('moderatorpermissions', 'caneditposts', $linkid, false, $link['parentid'])) {
                 throw new vB_Exception_Api('no_permission');
             }
         } else {
             if (!vB::getUserContext()->getChannelPermission('forumpermissions', 'canview', $linkid, false, $link['parentid'])) {
                 throw new vB_Exception_Api('no_permission');
             }
         }
     }
     //if we got here, this user is authorized to see this. image.
     $params = array('filedataid' => $link['filedataid'], 'type' => $type);
     $image = vB::getDbAssertor()->getRow('vBForum:getFiledataContent', $params);
     if (empty($image)) {
         return false;
     }
     $imageHandler = vB_Image::instance();
     return $imageHandler->loadFileData($image, $type, true);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:36,代码来源:link.php


示例15: prefetchFiledata

 public function prefetchFiledata($filedataids)
 {
     if (!empty($filedataids)) {
         $imagehandler = vB_Image::instance();
         $filedataRecords = Api_InterfaceAbstract::instance()->callApi('filedata', 'fetchFiledataByid', array($filedataids));
         foreach ($filedataRecords as $record) {
             $record['isImage'] = $imagehandler->isImage($record['extension']);
             $this->filedatas[$record['filedataid']] = $record;
         }
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:11,代码来源:bbcode.php


示例16: fetchImageByFiledataid

 /**
  * Fetch image information about an attachment based on file data id
  *
  * @param  int   Filedataid
  * @param  bool  Thumbnail version requested?
  * @param  bool  Should we include the image content
  *
  * @return mixed Array of data, includes filesize, dateline, htmltype, filename, extension, and filedataid
  */
 public function fetchImageByFiledataid($id, $type = vB_Api_Filedata::SIZE_FULL, $includeData = true)
 {
     if (empty($id) or !intval($id)) {
         throw new Exception('invalid_request');
     }
     $type = vB_Api::instanceInternal('filedata')->sanitizeFiletype($type);
     //If the record belongs to this user, or if this user can view attachments
     //in this section, then this is O.K.
     $userinfo = vB::getCurrentSession()->fetch_userinfo();
     $params = array('filedataid' => $id, 'type' => $type);
     $record = vB::getDbAssertor()->getRow('vBForum:getFiledataContent', $params);
     if (empty($record)) {
         return false;
     }
     if ($userinfo['userid'] == $record['userid'] or $record['publicview'] > 0) {
         return vB_Image::instance()->loadFileData($record, $type, $includeData);
     }
     throw new vB_Exception_Api('no_view_permissions');
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:28,代码来源:attach.php


示例17: UpdatevBAvatar

 public function UpdatevBAvatar(array $info)
 {
     if (empty($info['username'])) {
         return false;
     }
     $username = $info['username'];
     if (DLE_CHARSET && DLE_CHARSET != $this->vbulletin->userinfo['lang_charset']) {
         $username = iconv($this->vbulletin->userinfo['lang_charset'], DLE_CHARSET, $username);
     }
     if ($this->vbulletin->userinfo['username'] != $username) {
         $this->vbulletin->userinfo = $this->vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE username='{$username}'");
     }
     if ($this->vbulletin->userinfo['userid']) {
         $this->vbulletin->userinfo = fetch_userinfo($this->vbulletin->userinfo['userid'], (defined('IN_CONTROL_PANEL') ? 16 : 0) + (defined('AVATAR_ON_NAVBAR') ? 2 : 0));
         cache_permissions($this->vbulletin->userinfo);
         if (!empty($info['delete'])) {
             if ($this->vbulletin->userinfo['avatarid']) {
                 $userdata =& datamanager_init('User', $this->vbulletin, ERRTYPE_STANDARD);
                 $userdata->set_existing($this->vbulletin->userinfo);
                 $userdata->set('avatarid', 0);
                 $userdata->save();
             } else {
                 $userpic =& datamanager_init('Userpic_Avatar', $this->vbulletin, ERRTYPE_STANDARD, 'userpic');
                 $userpic->condition = 'userid = ' . $this->vbulletin->userinfo['userid'];
                 $userpic->delete();
             }
         } elseif (!empty($info['avatarurl'])) {
             require_once DIR . '/includes/class_upload.php';
             require_once DIR . '/includes/class_image.php';
             $upload = new vB_Upload_Userpic($this->vbulletin);
             $upload->data =& datamanager_init('Userpic_Avatar', $this->vbulletin, ERRTYPE_STANDARD, 'userpic');
             $upload->image =& vB_Image::fetch_library($this->vbulletin);
             $upload->maxwidth = $this->vbulletin->userinfo['permissions']['avatarmaxwidth'];
             $upload->maxheight = $this->vbulletin->userinfo['permissions']['avatarmaxheight'];
             $upload->maxuploadsize = $this->vbulletin->userinfo['permissions']['avatarmaxsize'];
             $upload->allowanimation = $this->vbulletin->userinfo['permissions']['genericpermissions'] & $this->vbulletin->bf_ugp_genericpermissions['cananimateavatar'] ? true : false;
             $upload->process_upload($info['avatarurl']);
             $userdata =& datamanager_init('User', $this->vbulletin, ERRTYPE_STANDARD);
             $userdata->set_existing($this->vbulletin->userinfo);
             $userdata->set('avatarid', 0);
             $userdata->save();
         }
     }
 }
开发者ID:dautushenka,项目名称:dle-vb,代码行数:44,代码来源:class_dle_integration.php


示例18: doAction

 function doAction($action)
 {
     global $vbulletin, $vbphrase, $KBANK_HOOK_NAME;
     if ($action == 'use') {
         if ($this->ready2Enable()) {
             $item_new = array('status' => KBANK_ITEM_USED_WAITING, 'expire_time' => iif($this->data['options']['duration'] > 0, TIMENOW + $this->data['options']['duration'] * 24 * 60 * 60, -1));
             $vbulletin->db->query_write(fetch_query_sql($item_new, 'kbank_items', "WHERE itemid = {$this->data[itemid]}"));
             if ($this->isAvatarItem and !$this->isSigPicItem) {
                 $vbulletin->url = "profile.php?" . $vbulletin->session->vars['sessionurl'] . "do=editavatar";
             } else {
                 if (!$this->isAvatarItem and $this->isSigPicItem) {
                     $vbulletin->url = "profile.php?" . $vbulletin->session->vars['sessionurl'] . "do=editsignature";
                 } else {
                     $vbulletin->url = "profile.php?" . $vbulletin->session->vars['sessionurl'];
                 }
             }
             eval(print_standard_redirect('kbank_use_successful'));
         }
     }
     if ($action == 'work' && $KBANK_HOOK_NAME == KBANK_GLOBAL_START && THIS_SCRIPT == 'profile') {
         global $permissions;
         $this->do_permissions($permissions, $this->itemtypedata['options']);
         //Update for later use (?)
         $vbulletin->userinfo['permissions'] = $permissions;
     }
     if ($action == 'work_expired') {
         global $vbphrase, $kbank_profile_images;
         $donow = true;
         $actionStatus = true;
         echo "Processing item ID#{$this->data[itemid]}<br/>";
         //Search for activating item
         if (!isset($kbank_profile_images[$this->data['userid']])) {
             $kbank_profile_images[$this->data['userid']] = array();
             $itemtypes = $vbulletin->db->query_read("\n\t\t\t\t\t\tSELECT \n\t\t\t\t\t\t\titems.itemid AS itemid\n\t\t\t\t\t\t\t, itemtypes.options AS itemtypeoptions\n\t\t\t\t\t\tFROM `" . TABLE_PREFIX . "kbank_items` AS items\n\t\t\t\t\t\tINNER JOIN `" . TABLE_PREFIX . "kbank_itemtypes` AS itemtypes ON (itemtypes.itemtypeid = items.type)\n\t\t\t\t\t\tWHERE itemtypes.filename = 'profile_images.kbank.php'\n\t\t\t\t\t\t\tAND items.status = " . KBANK_ITEM_USED_WAITING . "\n\t\t\t\t\t\t\tAND (items.expire_time > " . TIMENOW . "\n\t\t\t\t\t\t\t\tOR items.expire_time < 0)\n\t\t\t\t\t\t\tAND items.userid = {$this->data['userid']}\n\t\t\t\t\t");
             while ($itemtype = $vbulletin->db->fetch_array($itemtypes)) {
                 $tmp = unserialize($itemtype['itemtypeoptions']);
                 foreach ($this->vars as $var) {
                     $kbank_profile_images[$this->data['userid']][$var] = max($kbank_profile_images[$this->data['userid']][$var], $tmp[$var]);
                 }
             }
         }
         //Check for activating item
         $donow = false;
         foreach ($this->vars as $var) {
             if ($kbank_profile_images[$this->data['userid']][$var] < $this->itemtypedata['options'][$var]) {
                 $donow = true;
             }
         }
         if (!$donow) {
             //Found other stuff can handle everything
             echo 'User have other item(s), nothing to do now!<br/>';
         }
         $status = array();
         $message = array();
         if ($donow) {
             $owner = fetch_userinfo($this->data['userid']);
             cache_permissions($owner, false);
             //Apply activating options to owner permissions;
             $this->do_permissions($owner['permissions'], $kbank_profile_images[$this->data['userid']]);
             foreach (array('Avatar', 'SigPic') as $type) {
                 //If this item is this type
                 eval('$work = iif($this->is' . $type . 'Item,true,false);');
                 switch ($type) {
                     case 'Avatar':
                         $table = 'customavatar';
                         $fullname = 'avatar';
                         $bits = $vbulletin->bf_ugp_genericpermissions;
                         $permkey = 'genericpermissions';
                         $canuse = 'canuseavatar';
                         $dm = 'Userpic_Avatar';
                         break;
                     case 'SigPic':
                         $table = 'sigpic';
                         $fullname = 'sigpic';
                         $bits = $vbulletin->bf_ugp_signaturepermissions;
                         $permkey = 'signaturepermissions';
                         $canuse = 'cansigpic';
                         $dm = 'Userpic_Sigpic';
                         break;
                 }
                 if ($work) {
                     $removenow = false;
                     $updatedone = false;
                     $message[$type] = '';
                     $status[$type] = 'none';
                     //Check if user using system avatar
                     if ($type == 'Avatar' and $owner['avatarid'] != 0) {
                         //Check for System Avatar (only check with type = avatar)
                         echo 'User using System Avatar, do nothing!<br/>';
                     } else {
                         //Check for custom image
                         if ($customimg = $vbulletin->db->query_first("\n\t\t\t\t\t\t\t\t\tSELECT filedata, dateline, filename, filesize\n\t\t\t\t\t\t\t\t\tFROM `" . TABLE_PREFIX . $table . "`\n\t\t\t\t\t\t\t\t\tWHERE userid = " . intval($owner['userid']) . "\n\t\t\t\t\t\t\t\t\tORDER BY dateline DESC\n\t\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t\t")) {
                             $extension = trim(substr(strrchr(strtolower($customimg['filename']), '.'), 1));
                             $tmp_filename = DIR . "/includes/tmp_profile_images_{$customimg['dateline']}.{$extension}";
                             $tmp_file = fopen($tmp_filename, 'w');
                             fwrite($tmp_file, $customimg['filedata']);
                             fclose($tmp_file);
                             require_once DIR . '/includes/class_image.php';
                             $image =& vB_Image::fetch_library($vbulletin);
                             $imginfo = $image->fetch_image_info($tmp_filename);
//.........这里部分代码省略.........
开发者ID:0hyeah,项目名称:yurivn,代码行数:101,代码来源:profile_images.kbank.php


示例19: upload

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP vB_Library类代码示例发布时间:2022-05-23
下一篇:
PHP vB_DataManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap