本文整理汇总了PHP中Uploader::imageFile2attach方法的典型用法代码示例。如果您正苦于以下问题:PHP Uploader::imageFile2attach方法的具体用法?PHP Uploader::imageFile2attach怎么用?PHP Uploader::imageFile2attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uploader
的用法示例。
在下文中一共展示了Uploader::imageFile2attach方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadPic
public function uploadPic($request, $response)
{
/*{{{*/
$thesisId = $request->thesisId;
$file = $_FILES['file'];
$user = $this->curOperatorUser;
$filePath = '';
if ($file['error'] == 0) {
$attach = Uploader::imageFile2attach($user, $file, Attachment::TYPE_JPG, $user->id, Attachment::HOSTTYPE_HDFADMIN);
if ($attach instanceof Attachment) {
$filePath = $attach->filePath;
}
}
if ($filePath) {
ThesisClient::getInstance()->modifyThesisPicurl($thesisId, $filePath);
}
$msg = '文章图片修改成功';
$url = $response->router->urlfor('thesis/modifypic', array('msg' => $msg, 'thesisId' => $thesisId));
$response->setRedirect($url);
}
示例2: uploadPic
public function uploadPic($request, $response)
{
/*{{{*/
$paperId = $request->paperId;
$type = empty($request->type) ? $request->type : "";
$file = $_FILES['file'];
$user = $this->curOperatorUser;
$filePath = '';
if ($file['error'] == 0) {
$attach = Uploader::imageFile2attach($user, $file, Attachment::TYPE_JPG, $user->id, Attachment::HOSTTYPE_HDFADMIN);
if ($attach instanceof Attachment) {
$filePath = $attach->filePath;
}
}
if ($filePath) {
if (empty($type)) {
PaperClient::getInstance()->modifyPaperPicurl($paperId, $filePath);
} else {
PaperClient::getInstance()->modifyPaperAdPicurl($paperId, $filePath);
}
}
$msg = '专题图片修改成功';
$url = $response->router->urlfor('paper/modifypic', array('msg' => $msg, 'paperId' => $paperId, 'type' => $type));
$response->setRedirect($url);
}
示例3: uploadAttachmentPost
public function uploadAttachmentPost($request, $response)
{
/*{{{*/
$file = $_FILES['file'];
$projectOperator = $this->myProjectOperator;
$user = $projectOperator->user;
$filePath = '';
if ($file['error'] == 0) {
$attachment = Uploader::imageFile2attach($user, $file, Attachment::TYPE_JPG, 0, 'WxArticle');
if ($attachment instanceof Attachment) {
WxMgrClient::getInstance()->modifyWxArticleAttachment($request->wxArticleId, $attachment->id);
}
}
$response->setRedirect("/wxmgr/modifywxarticle?wxArticleId={$request->wxArticleId}&preMsg=" . urlencode('修改成功'));
}
示例4: uploadPic
public function uploadPic($request, $response)
{
/*{{{*/
$articleId = $request->articleId;
$file = $_FILES['file'];
$user = $this->curOperatorUser;
$filePath = "";
if ($file['error'] == 0) {
$attach = Uploader::imageFile2attach($user, $file, Attachment::TYPE_JPG, $user->id, Attachment::HOSTTYPE_HDFADMIN);
if ($attach instanceof Attachment) {
$filePath = $attach->filePath;
}
}
if ($filePath) {
ArticleClient::getInstance()->modifyArticlePicUrl($articleId, $filePath, $user->id);
}
$msg = 'ндубм╪ф╛пч╦дЁи╧╕';
$url = $response->router->urlfor('article/modifypic', array('msg' => $msg, 'articleId' => $articleId));
$response->setRedirect($url);
}