本文整理汇总了PHP中image::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP image::insert方法的具体用法?PHP image::insert怎么用?PHP image::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: header
$error[] = 'plz, upload image type';
} else {
if ($size1 > 42565433) {
$error[] = 'plz, dun exceed the max limit of size';
} else {
move_uploaded_file($tmp_name1, 'images/' . $name1);
}
}
if (!isset($_POST['option'])) {
$error[] = 'plz , select a product';
}
if (empty($error)) {
$img->image_path = $name;
$img->image_path_1 = $name1;
$img->product_id = $_POST['option'];
$img->insert();
}
if (!empty($error)) {
$_SESSION['errors'] = $error;
header('location: image_insert.php');
} else {
header('location: image_control.php');
}
} else {
if (isset($_POST['sendupdate'])) {
$img = new image($_POST['id']);
$name = $_FILES['image']['name'];
$size = $_FILES['image']['size'];
$type = $_FILES['image']['type'];
$tmp_name = $_FILES['image']['tmp_name'];
$error = [];