本文整理汇总了PHP中uploadImg函数的典型用法代码示例。如果您正苦于以下问题:PHP uploadImg函数的具体用法?PHP uploadImg怎么用?PHP uploadImg使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uploadImg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例2: _before_update
public function _before_update()
{
//调用函数库中的图片上传函数
$result = uploadImg($data, $options, false);
//判断图片是否处理成功
if (!$result[0]) {
//如果返回false,则上传图片失败
$this->error = $result[1];
}
}
示例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);
}
示例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');
}
示例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
示例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)) {
示例7: index
public function index()
{
uploadImg();
phpinfo();
}
示例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)
示例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;
}
示例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');
?>
示例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");
示例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'));
}
示例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'] = '评论失败!';
}
示例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}'");
示例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;
}