本文整理汇总了PHP中image::upload方法的典型用法代码示例。如果您正苦于以下问题:PHP image::upload方法的具体用法?PHP image::upload怎么用?PHP image::upload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::upload方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doPOST
public function doPOST()
{
require DB_PATH . '/core/lib/image.php';
$img = new image($this->db);
try {
$img->upload($this->auth->authenticated());
redirect('view', $img->getentryid());
} catch (ImageException $e) {
if ($e->rollback) {
$img->rollback();
}
$_SESSION['upload_errors'][] = $e->getMessage();
redirect('upload');
}
}
示例2: submit
public function submit()
{
$post = $_POST;
$file = $_FILES['file_upload'];
$request = new post($post, $file);
$submission = $request->getPost();
$database = new database();
$query = $database->query();
$image = new image($query, $submission);
// upload image
try {
$upload = $image->upload();
} catch (Exception $e) {
echo 'Message: ' . $e->getMessage();
}
// insert image
if (isset($upload) && $upload == 'success') {
$images = new image($query, $submission);
$image->insert();
}
}
示例3: strrchr
$ext = strrchr($_FILES["photo"]['name'][$key], ".");
$ran_num = (time() | 0) . "_" . rand(0, 999999999);
$output_path = "../../gallery_activity/";
$file_name = $id . "_{$ran_num}.png";
$ori_file_name = $id . "_{$ran_num}{$ext}";
// $size = GetImageSize($upfile);
// copy($upfile,$output_path.$file_name);
// image_resize( $upfile, $output_filename, $output_path, 190, 120);
// // copy($upfile,$output_path."small/".$file_name);
// image_resize( $upfile, $output_filename, $output_path, 90, 60);
// copy( $upfile, $output_path."original/".$ori_file_name );
$image = (require_once "../../include/image.class.php");
$image = new image();
$image->source = $_FILES['photo']["tmp_name"][$key];
$image->allow_size = 5;
$image->save_path = "../../gallery_activity/";
$image->save_name = $ori_file_name;
if ($image->upload()) {
// mysql_query("INSERT INTO tbl_file_attachment (`file_id`, `url`) value({$last_insert_id}, '{$filename}');");
$image->create_img(190, 120, 0, NULL, "web");
$image->create_img(90, 60, 0, NULL, "thumb");
}
$sql_c = "INSERT INTO `tbl_activity_gallery` ( `act_id`, `file_name`, `ori_file_name`, `remark`, `g_order` ) VALUES ('{$id}', '{$ori_file_name}', '{$ori_file_name}', '{$remark}', {$g_order} )";
mysql_query("set names utf8");
mysql_query($sql_c, $link_id);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
/* End Upload Photo */
//////////////////////////////////////////////////////////////////////////////////////////////////////
mysql_close();
示例4: EncodeHTMLTag
// require_once("../../include/image.class.php");
$id = $_POST[id] | 0;
foreach ($_FILES["photo"]["error"] as $key => $error) {
if ($error == 0) {
$upfile = $_FILES["photo"]["tmp_name"][$key];
$remark = EncodeHTMLTag($_POST["remark"][$key]);
$g_order = $_POST["order"][$key] | 0;
$ext = strrchr($_FILES["photo"]['name'][$key], ".");
$ran_num = (time() | 0) . "_" . rand(0, 999999999);
$output_path = "../../gallery_activity/";
$file_name = $id . "_{$ran_num}.png";
$ori_file_name = $id . "_{$ran_num}{$ext}";
$image = (require_once "../../include/image.class.php");
$image = new image();
$image->source = $_FILES['photo']["tmp_name"][$key];
$image->allow_size = 5;
$image->save_path = "../../gallery_activity/";
$image->save_name = $ori_file_name;
$image->upload();
$image->create_img(190, 120, 0, NULL, "web");
$image->create_img(90, 60, 0, NULL, "thumb");
$sql_c = "INSERT INTO `tbl_lastest_gallery` ( `act_id`, `file_name`, `ori_file_name`, `remark`, `g_order` ) VALUES ('{$id}', '{$ori_file_name}', '{$ori_file_name}', '{$remark}', {$g_order} )";
mysql_query("set names utf8");
mysql_query($sql_c, $link_id);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
/* End Upload Photo */
//////////////////////////////////////////////////////////////////////////////////////////////////////
mysql_close();
header("location:gallery.php?id={$_POST['id']}");
示例5: date
$telp_kantor = $form->input('telp_kantor');
$faksimil = $form->input('faksimil');
$email = $form->input('email');
$action = $form->input('action');
$user = $_SESSION['nama'];
$date = date('Y-m-d H:i:s');
// START INSERT DATA ==============================>
if ($action == "insert") {
$foto = $_FILES['foto']['name'];
$id = $number->id('anggota', 5);
$kta_baru = $number->kta($desa_id, $tgl_lahir, $id);
if (empty($foto)) {
$foto = "user.png";
} else {
$source = $_FILES['foto']['tmp_name'];
$image->upload($foto, $source);
$image->thumbnail($foto);
}
$sql = "INSERT INTO anggota\n (id,nama, id_tipe, id_no, jabatan, tempat, tgl_lahir, jns_kelamin, agama,\n pernikahan, pekerjaan_id, pendidikan, alamat, rt, rw, propinsi_id, kota_id, kecamatan_id,\n desa_id, hp, telp_rumah, telp_kantor, faksimil, email, foto, kta_baru, aktif, crt, crt_date) \n VALUES \n ('{$id}','{$nama}','{$id_tipe}','{$id_no}','{$jabatan}','{$tempat}','{$tgl_lahir}','{$jns_kelamin}','{$agama}',\n '{$pernikahan}','{$pekerjaan_id}','{$pendidikan}','{$alamat}','{$rt}','{$rw}','{$propinsi_id}','{$kota_id}','{$kecamatan_id}',\n '{$desa_id}','{$hp}','{$telp_rumah}','{$telp_kantor}','{$faksimil}','{$email}','{$foto}','{$kta_baru}','{$aktif}','{$user}','{$date}')";
if (!$database->query($sql)) {
die($sql);
} else {
$_SESSION['success'] = "<b>Berhasil!</b> Anda telah menambahkan data baru";
header("Location: create.php");
exit;
}
}
// END INSERT DATA ==============================>
// START UPDATE DATA ==============================>
if ($action == "update") {
$id = $form->input('id');