本文整理汇总了PHP中uploadImg函数的典型用法代码示例。如果您正苦于以下问题:PHP uploadImg函数的具体用法?PHP uploadImg怎么用?PHP uploadImg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uploadImg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _before_update
/**
* 在商品更新之前,更新图片信息。
* @param [type] &$data 更新的数据
* @param [type] $options
* @return [type]
*/
public function _before_update(&$data, $options)
{
/*****************同时更新图片路径*****************/
//调用函数库中的图片上传函数
$result = uploadImg($data, $options);
//判断图片是否处理成功
if (!$result[0]) {
//如果返回false,则上传图片失败
$this->error = $result[1];
}
/************判断分类是否更改,再进行分类数量的相应删除与增加************/
if (!empty($data['cat_id'])) {
//根据options获取更新的id
$id = $options['where']['id'];
//判断商品分类cat_id是否改变
$oldGoods = M('goods')->field('cat_id')->find($id);
//旧分类id
$newCat_id = $data['cat_id'];
//新分类id
//比较新旧
if ($oldGoods['cat_id'] != $newCat_id) {
//删除原分类的商品数量
$old = M('category')->query("update my_category set goods_num = goods_num - 1 where id = " . $oldGoods['cat_id']);
//增加新分类的商品数量
$new = M('category')->query("update my_category set goods_num = goods_num + 1 where id = " . $newCat_id);
}
}
}
开发者ID:huangzhenwen,项目名称:Shopping-Mall,代码行数:34,代码来源:GoodsModel.class.php
示例2: _before_update
public function _before_update()
{
//调用函数库中的图片上传函数
$result = uploadImg($data, $options, false);
//判断图片是否处理成功
if (!$result[0]) {
//如果返回false,则上传图片失败
$this->error = $result[1];
}
}
开发者ID:huangzhenwen,项目名称:Shopping-Mall,代码行数:10,代码来源:BrandModel.class.php
示例3: upload_image_post
public function upload_image_post()
{
$this->check_token();
$array = uploadImg();
if (!empty($array)) {
$result = array();
$result['sha1'] = $array[0]['sha1'];
$result['path'] = $array[0]['path'];
$result['status'] = $array[0]['status'];
$this->success($result);
}
$this->error(1417);
}
开发者ID:jkzleond,项目名称:alhelp_api,代码行数:13,代码来源:IndexController.class.php
示例4: adicionartimeAction
public function adicionartimeAction()
{
$this->_helper->viewRenderer->setNoRender();
$dados = $this->_request->getPost();
$dados['time']['img'] = uploadImg();
/* $adapter = new Zend_File_Transfer_Adapter_Http();
$adapter->setDestination('/var/www/trunk/bolao/public/imagens/emblems');
if (!$adapter->receive())
{
$messages = $adapter->getMessages();
echo implode("\n", $messages);
}
$upload = new Zend_File_Transfer();
$files = $upload->getFileInfo();
foreach ($files as $file => $info)
{
if ($upload->isUploaded($file)){
echo 'campo de imagem vazio';
continue;
}
}
if (!$upload->isValid($file))
{
dump("erro...");
}
dump($files,1);
dump($dados,1); */
if ($this->_request->isPost()) {
$mTime = new Application_Model_Time();
$mTime->insert($dados['time']);
}
$this->_forward('times');
}
开发者ID:r4faelaugusto,项目名称:b0l4od0fu7uro,代码行数:38,代码来源:ConfigController.php
示例5: isset
$action = $param[0];
$cfile = $param[1];
// current filename
$nfile = $param[2];
// new filename
if (!($nfile = renameImg($clib, $cfile, $nfile))) {
echo $l->m('er_001') . ': ' . $l->m('er_041');
}
} else {
if ($param[0] == 'upload') {
// action: upload image
$action = $param[0];
$chkT = isset($_REQUEST['chkThumbSize']) ? $_REQUEST['chkThumbSize'] : array();
// thumb-sizes in Array
if (isset($_FILES['nfile']['name'][0])) {
if (!($nfile = uploadImg($clib, $chkT))) {
echo $l->m('er_001') . ': ' . $l->m('er_028');
}
}
} else {
if ($param[0] == 'create') {
// action: create directory
$action = $param[0];
$nfile = $param[1];
// new filename
if (!createDir($clib, $nfile)) {
echo $l->m('er_001') . ': ' . $l->m('er_042');
}
} else {
if ($param[0] == 'update') {
// action: update image list and select current image
开发者ID:rhempen,项目名称:cms,代码行数:31,代码来源:rfiles.php
示例6: header
<?php
header("Access-Control-Origin: *");
//echo "imagepanel";
$function_code = $_REQUEST["code"];
require_once "./condb.php";
global $con;
if (isset($function_code)) {
switch ($function_code) {
case 'download':
getImg();
break;
case 'upload':
if (isset($_REQUEST['id']) && isset($_REQUEST['name']) && isset($_FILES)) {
uploadImg();
}
break;
default:
//echo "string";
break;
}
}
//Recuperar imagenes a editar de DB..
function getImg()
{
global $con;
try {
$sql = $con->prepare("SELECT img_id, img_name FROM imagenes WHERE visible='no'");
$sql->execute();
$imagenes = array();
while ($img = $sql->fetch(PDO::FETCH_ASSOC)) {
开发者ID:Astronico,项目名称:ImagePanel,代码行数:31,代码来源:imagepanel.php
示例7: index
public function index()
{
uploadImg();
phpinfo();
}
开发者ID:jkzleond,项目名称:alhelp_api,代码行数:5,代码来源:ImagesController.class.php
示例8: uploadImg
}
if (isset($_FILES['button_3_pic_hover'])) {
$was_upload = uploadImg($_FILES['button_3_pic_hover'], 'button_3_pic_hover');
if ($was_upload) {
?>
<img id='uploaded_image_pc' class='box' src='admin_images/<?php
echo $was_upload;
?>
'/>
<?php
}
}
if (isset($_FILES['uploaded_file'])) {
//פה אני בודק האם צריך להחליף רקע לאחד העמודים לא משנה לאיזה עמוד אני עושה אותו הדבר ובודק בסוויטצ
//echo($_POST['page_name']);
$was_upload = uploadImg($_FILES['uploaded_file'], $_POST['page_name']);
if ($was_upload) {
?>
<img id='uploaded_image_pc' class='box' src='admin_images/<?php
echo $was_upload;
?>
'/>
<?php
}
}
if (isset($_POST['movie_site_url'])) {
$main_screen->movie_site_url = $_POST['movie_site_url'];
}
$main_screen->Update();
//מעדכן את כל מה שצריך עדכון בבת אחת
function uploadImg($file, $choose_page)
开发者ID:restartit,项目名称:test,代码行数:31,代码来源:file_upload.php
示例9: doUpload
function doUpload()
{
$db = new db();
$name = $_POST['bookname'];
if ($_POST['author'] != '') {
$author = $_POST['author'];
} else {
$author = '未知';
}
if ($_POST['desc'] != '') {
$desc = $_POST['desc'];
} else {
$desc = '无';
}
if ($_POST['authordesc'] != '') {
$authorDesc = $_POST['authordesc'];
} else {
$authorDesc = '无';
}
if ($_POST['tag'] != '') {
$tag = $_POST['tag'];
} else {
$tag = '其他';
}
if ($_POST['isbn'] != '') {
$isbn = $_POST['isbn'];
} else {
$isbn = 0;
}
if (isset($_SESSION['email']) && $_SESSION['email'] != '') {
$uploader = $_SESSION['email'];
} else {
$uploader = '匿名';
}
$id = $db->addBook($name, $author, $tag, $isbn, $desc, $authorDesc, $uploader);
move_uploaded_file($_FILES["file"]["tmp_name"], './jae/' . $id . '.mobi');
uploadEbook('./jae/' . $id . '.mobi');
if ($_POST['pic-id'] != '') {
rename('./jae/' . $_POST['pic-id'], './jae/' . $id . '.jpg');
} else {
createCover($name, $author, $id);
}
uploadImg('./jae/' . $id . '.jpg');
unlink('./jae/' . $id . '.mobi');
return $id;
}
开发者ID:andy-sheng,项目名称:ebook,代码行数:46,代码来源:UploadController.class.php
示例10: array_walk
array_walk($value, 'is_array_value', $_imglib);
}
if ($value == $_imglib) {
$value_found = true;
}
}
array_walk($spaw_imglibs, 'is_array_value', $imglib);
if (!$value_found || empty($imglib)) {
$imglib = $spaw_imglibs[0]['value'];
}
$lib_options = liboptions($spaw_imglibs, '', $imglib);
$img = isset($HTTP_POST_VARS['imglist']) ? $HTTP_POST_VARS['imglist'] : '';
$preview = '';
$errors = array();
if (isset($HTTP_POST_FILES['img_file']['size']) && $HTTP_POST_FILES['img_file']['size'] > 0) {
if ($img = uploadImg('img_file')) {
$preview = $spaw_base_url . $imglib . $img;
}
}
// delete
if ($spaw_img_delete_allowed && isset($HTTP_POST_VARS['lib_action']) && $HTTP_POST_VARS['lib_action'] == 'delete' && !empty($img)) {
deleteImg();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title><?php
echo $l->m('title');
?>
开发者ID:racontemoi,项目名称:mamp,代码行数:31,代码来源:img_library.php
示例11: array
}
$data = array('id' => $id, 'author' => $_POST['author'], 'title' => $_POST['title'], 'brief' => $_POST['brief'], 'showpic' => $showPic, 'description' => $_POST['description'], 'fromurl' => $_POST['fromurl']);
if (isset($picPath) && !empty($picPath)) {
$data['picPath'] = $picPath;
}
$msgNews->updateById($data);
} else {
//添加
//msgBase
$msgBase = new MsgBase();
$baseData = array('msgType' => 'news', 'inputCode' => $_POST['inputCode'], 'createTime' => date('Y-m-d'));
$baseId = $msgBase->insert($baseData);
//msgNews
//上传图片
$picPath = '';
$uprst = uploadImg("imgFile");
if ($uprst['flag']) {
$picPath = $uprst['imgUrl'];
}
$msgNews = new MsgNews();
$showPic = 0;
if (!empty($_POST['showPic'])) {
$showPic = 1;
}
$data = array('base_id' => $baseId, 'author' => $_POST['author'], 'title' => $_POST['title'], 'brief' => $_POST['brief'], 'showpic' => $showPic, 'description' => $_POST['description'], 'fromurl' => $_POST['fromurl'], 'picPath' => $picPath);
$newsId = $msgNews->insert($data);
$url = 'http://' . $_SERVER['HTTP_HOST'] . $CONTEXT_PATH . '/wxapi/newsread.php?id' . $newsId;
$updata = array('id' => $newsId, 'url' => $url);
$msgNews->updateById($updata);
}
header("Location:" . $CONTEXT_PATH . "/wxcms/msgnewsList.php");
开发者ID:weixinpy,项目名称:phpweixin,代码行数:31,代码来源:msgnewsInputPost.php
示例12: test_uploadVkImg
public function test_uploadVkImg()
{
$this->assertNotFalse(uploadImg('[object Object]/||/http://41.media.tumblr.com/589273c45f9cdc7f768869793341c609/tumblr_nrkfd5ePWL1tmeibwo1_1280.jpg/||/http://33.media.tumblr.com/122c50e38e08a2d7f42c0fb4420ce3b9/tumblr_nu1mnxmQwN1r4p08ko1_540.gif/||/http://38.media.tumblr.com/486044aceccdc183918cea97f28fee4a/tumblr_n70uykf1S71qfoa77o1_500.gif/||/http://41.media.tumblr.com/83d9b40e8748d48d1416efd6a74761bb/tumblr_nsb2lgg0hB1r4p08ko1_1280.jpg'));
}
开发者ID:shpikyliak,项目名称:tumlrVkProject,代码行数:4,代码来源:uploadVkImgTest.php
示例13: getUser
<?php
require_once '../inc/common.php';
$user = getUser('mid');
$time = time();
$imgs = '';
$gid = isset($_REQUEST['gid']) ? (int) $_REQUEST['gid'] : 0;
if (!$gid) {
header("Location: goods.php");
die;
}
if ($_POST) {
$res = array('msg' => '');
if ($_FILES) {
$res = uploadImg($_FILES);
if ($res['msg']) {
die(json_encode($res));
}
if (isset($res['imgs'])) {
$imgs = implode('|', $res['imgs']);
}
}
$content = htmlspecialchars($_POST['content']);
$sql = "INSERT INTO m_comment SET pid=:gid, mid='{$user['mid']}',ctime='{$time}',imgs='{$imgs}',content=:content";
$sth = $db->prepare($sql);
$sth->bindParam(':gid', $gid);
$sth->bindParam(':content', $content);
$sth->execute();
if (!$db->lastInsertId()) {
$res['msg'] = '评论失败!';
}
开发者ID:noikiy,项目名称:meilala,代码行数:31,代码来源:act_comment-0526.php
示例14: uploadImg
}
if (isset($_FILES['img_upload'])) {
if ($_POST['port_folder'] == 'no') {
$folder = $_POST['folder'];
if (strlen($_POST['newfolder']) > 2) {
$folder = $_POST['newfolder'];
}
}
if ($_POST['port_folder'] == 'yes') {
$folder = $_POST['port_folder_selection'];
if (strlen($_POST['new_port_folder']) > 2) {
$folder = $_POST['new_port_folder'];
$folder = "Portfolio/" . $folder;
}
}
uploadImg($_FILES['img_upload'], $folder);
getPhotosBlog();
folder();
portFolder();
getPhotos();
}
if (isset($_POST['editabout']) && isset($_POST['mission'])) {
$name = $_POST['editabout'];
$ins = $_POST['mission'];
$ins = escape($ins);
if (strlen($ins) > 5) {
doQuery("UPDATE info SET text = '{$ins}' WHERE (subsection ='name_content' OR subsection ='a_statement') AND title='{$name}'");
}
if (strlen($_POST['team_img']) > 3) {
$img = $_POST['team_img'];
doQuery("UPDATE info SET img = '{$img}' WHERE (subsection ='name_content' OR subsection ='a_statement') AND title='{$name}'");
开发者ID:Cjones90,项目名称:Legacy-Projects,代码行数:31,代码来源:submit.php
示例15: glob
$imgs[] = "{$image}";
}
$directory = "pictures/*/";
$images = glob("" . $directory . "*.jpg");
foreach ($images as $image) {
$imgs[] = "{$image}";
}
$directory = "pictures/*/*/";
$images = glob("" . $directory . "*.jpg");
foreach ($images as $image) {
$imgs[] = "{$image}";
}
$directory = "pictures/*/*/*/";
$images = glob("" . $directory . "*.jpg");
foreach ($images as $image) {
$imgs[] = "{$image}";
}
$directory = "pictures/*/*/*/*/";
$images = glob("" . $directory . "*.jpg");
foreach ($images as $image) {
$imgs[] = "{$image}";
}
shuffle($imgs);
$response = json_decode(uploadImg("@" . $imgs[5]));
postImg($response->payload->url);
}
preg_match('/(snape,?|!) ?list(\\s*)(save ?plates)?/i', $text, $matches);
if ($matches != null) {
listNames();
exit;
}
开发者ID:njdelima,项目名称:groupme-bots,代码行数:31,代码来源:snape.php
示例16: curl_setopt
curl_setopt($ch, CURLOPT_URL, $link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams);
$response = curl_exec($ch);
$photoParams = json_decode($response);
$photo = $photoParams->photo;
$server = $photoParams->server;
$url = 'https://api.vk.com/method/photos.saveWallPhoto?group_id=' . $group_id . '&v=5.5&photo=' . $photo . '&server=' . $server . '&hash=' . $photoParams->hash . '&access_token=' . $token;
$an = get_curl($url);
$save = json_decode($an)->response;
$attachments = "";
for ($i = 0; $i < count($save); $i++) {
$attachments = $attachments . "photo" . $user_uid . "_" . $save[$i]->id . ',';
}
$url = 'https://api.vk.com/method/wall.post?owner_id=-' . $group_id . '&from_group=1&attachments=' . $attachments . '&access_token=' . $token;
$an = get_curl($url);
if (!isset(\GuzzleHttp\json_decode($an)->response)) {
echo "Unknown error";
return false;
} else {
echo "Images is successfully uploaded";
return true;
}
} else {
echo "ERROR! You upload more than 6 images OR all your pics are GIFs !";
return false;
}
}
uploadImg($_POST['images']);
开发者ID:shpikyliak,项目名称:tumlrVkProject,代码行数:30,代码来源:uploadVkImg.php
示例17: liboptions
break;
}
}
if (!$value_found || empty($lib)) {
$cur_imglib = $spaw_imglibs[0];
$lib = $spaw_imglibs[0]['catID'];
}
$lib_options = liboptions($spaw_imglibs, '', $lib);
if (isset($_POST['imglist'])) {
$img_params = explode(SPAW_VSEP, $_POST['imglist']);
$img = basename($img_params[1]);
}
$preview = '';
$errors = array();
if (isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) {
$img = uploadImg('img_file', $cur_imglib);
}
// delete confirm
if ($cur_imglib['delete_allowed'] && isset($_POST['lib_action']) && $_POST['lib_action'] == 'delete' && !empty($img)) {
deleteConfirm($cur_imglib);
}
// delete
if ($cur_imglib['delete_allowed'] && isset($_POST['lib_action']) && $_POST['lib_action'] == 'dodelete' && !empty($img)) {
deleteImg($cur_imglib, $img);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=<?php
开发者ID:nobunobuta,项目名称:xoops_mod_WordPress,代码行数:31,代码来源:img_library.php
示例18: define
<?php
define("DS", DIRECTORY_SEPARATOR);
define("ROOT", dirname(dirname(__FILE__)));
include_once ROOT . DS . "Model" . DS . "DataAccess.php";
$areaId = $_GET['area'];
$conn = new DataAccess("hciForum");
if ($_POST['sub']) {
$areaId = $_POST['areaId'];
$areaIcon = uploadImg("file");
if ($areaIcon == "") {
echo "failed";
} else {
$sql = "UPDATE `area` SET icon_url='{$areaIcon}' WHERE id='{$areaId}'";
if (mysql_query($sql)) {
echo "<script language=javascript>alert('添加成功');location='/HCI-forum/View/moderatorIndex.php?area={$areaId}';</script>";
}
}
} else {
}
$sql = "SELECT icon_url FROM `area` WHERE id='{$areaId}'";
$query = mysql_query($sql);
while ($area_rows = mysql_fetch_array($query)) {
$iconUrl = $area_rows[0];
}
function uploadImg($file)
{
if (($_FILES[$file]["type"] == "image/gif" || $_FILES[$file]["type"] == "image/jpeg" || $_FILES[$file]["type"] == "image/pjpeg" || $_FILES[$file]["type"] == "image/png") && $_FILES[$file]["size"] < 2000000) {
if ($_FILES[$file]["error"] > 0) {
return "";
} else {
开发者ID:dalinhuang,项目名称:HCI-forum,代码行数:31,代码来源:editLogo.php
示例19: upload
public function upload()
{
require $_SERVER['DOCUMENT_ROOT'] . "/Application/Lib/upload.php";
$result = uploadImg();
if ($result['result'] === false) {
$this->error($result['err']);
} else {
$this->insertReply($result['picDir'], date('Y-m-d H:i:s'));
}
$this->refreshDetail();
}
开发者ID:magiclake,项目名称:chaowei,代码行数:11,代码来源:UseropinionController.class.php
示例20: date_default_timezone_set
{
date_default_timezone_set("PRC");
$imgData = $req['img_data'];
$type = $req['type'];
$savefile = 'uploadImg/';
$time = date('YmdHis', time());
$filename = $savefile . $time;
$imgArr = array("image/jpg", "image/jpeg", "image/png", "image/gif");
if (in_array($type, $imgArr)) {
$img = base64_decode(str_replace('data:' . $type . ';base64,', '', $imgData));
switch ($type) {
case "image/jpeg":
case "image/jpg":
$filename = $filename . ".jpg";
break;
case "image/gif":
$filename = $filename . ".gif";
break;
case "image/png":
$filename = $filename . ".png";
break;
}
file_put_contents($filename, $img);
return $filename;
} else {
return false;
}
}
$req = $_REQUEST;
$src = uploadImg($req);
echo $src;
开发者ID:Add-One,项目名称:Design,代码行数:31,代码来源:upload.php
注:本文中的uploadImg函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论