当前位置: 首页>>代码示例>>PHP>>正文


PHP Photograph::save方法代码示例

本文整理汇总了PHP中Photograph::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Photograph::save方法的具体用法?PHP Photograph::save怎么用?PHP Photograph::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Photograph的用法示例。


在下文中一共展示了Photograph::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Photograph

     $bus_to_read_update->reg_number = $_POST['reg_number'];
     $bus_to_read_update->name = $_POST['name'];
     if ($bus_to_read_update->update()) {
         $session->message("Success! The Bus details were updated. ");
         redirect_to('admin-list-buses.php');
     } else {
         $session->message("Error! The Bus details could not be updated. ");
     }
 }
 if (isset($_POST['upload'])) {
     $photo_to_upload = new Photograph();
     $photo_to_upload->related_object_type = '3';
     $photo_to_upload->related_object_id = $_GET['busid'];
     $photo_to_upload->photo_type = $_POST['photo_type'];
     $photo_to_upload->attach_file_bus($_FILES['file_upload'], $photo_to_upload->bus_id, $photo_to_upload->photo_type);
     if ($photo_to_upload->save()) {
         $session->message("Success! The photo was uploaded successfully. ");
         redirect_to('admin-list-buses.php');
     } else {
         $message = join("<br />", $photo_to_upload->errors);
     }
 }
 if (isset($_POST['assign'])) {
     $buses_bus_personnel_to_read_update = new BusBusPersonnel();
     $buses_bus_personnel_to_read_update->bus_id = $_GET['busid'];
     $buses_bus_personnel_to_read_update->bus_personnel_id = $_POST['bus_personnel_id'];
     if ($buses_bus_personnel_to_read_update->create()) {
         $session->message("Success! The Bus Personnel was assigned to the given Bus. ");
         redirect_to('admin-list-buses.php');
     } else {
         $session->message("Error! The Bus Personnel was not assigned to the given Bus. ");
开发者ID:afthaj,项目名称:gaman-new,代码行数:31,代码来源:admin-read-update-bus.php

示例2: Photograph

                        redirect_to('admin-view-profile.php');
                    } else {
                        $session->message("Error! Your password could not be updated. ");
                    }
                } else {
                    $session->message("Error! The existing password did not match. ");
                }
            }
            if (isset($_POST['upload'])) {
                $photo = new Photograph();
                $photo->related_object_type = '4';
                $photo->related_object_id = $user->id;
                $photo->photo_type = 9;
                // photo_type 9 is "User Profile"
                $photo->attach_file_bus_personnel($_FILES['file_upload'], $user->id, $user->first_name, $user->last_name);
                if ($photo->save()) {
                    $session->message("Success! The photo was uploaded successfully. ");
                    redirect_to('admin-view-profile.php');
                } else {
                    $message = join("<br />", $photo->errors);
                }
            }
        } else {
            //everyone else
            $session->message("Error! You do not have sufficient priviledges to view the requested page. ");
            redirect_to("index.php");
        }
    }
} else {
    //not logged in... GTFO!
    $session->message("Error! You must login to view the requested page. ");
开发者ID:afthaj,项目名称:gaman-new,代码行数:31,代码来源:admin-view-profile.php

示例3: Photograph

$message2 = "";
$message3 = "";
$message4 = "";
if (isset($_POST['submit'])) {
    $photo = new Photograph();
    $photo->hotel_id = $hotel->id;
    $photo->attach_file($_FILES['upload_file']);
    if ($photo->save()) {
        $message1 = "Photographs was successfully uploaded";
    } else {
        $message1 = join("<br>", $photo->errors);
    }
    $photo1 = new Photograph();
    $photo1->hotel_id = $hotel->id;
    $photo1->attach_file($_FILES['upload_file1']);
    if ($photo1->save()) {
        $message2 = "Photographs was successfully uploaded";
    } else {
        $message2 = join("<br>", $photo1->errors);
    }
}
?>
<!DOCTYPE html>
<html>
<head>
	<title>
		Hotel
	</title>
	<link rel="stylesheet" type="text/css" href="../css/reset.css">
	<link rel="stylesheet" type="text/css" href="../css/hotel.css">
</head>
开发者ID:kochevRisto,项目名称:project,代码行数:31,代码来源:upload_photo.php

示例4: Exceeded

    echo "Maximum File size Exceeded(250Kb)";
    die;
}
if (!empty($photograph_details) && !empty($_FILES['picture']['name'])) {
    $photograph->image_id = $photograph_details->image_id;
    unlink(SITE_ROOT . DS . 'passport' . DS . $photograph_details->filename);
}
$arrayfiledetails = explode('.', $_FILES['picture']['name']);
$extension = $arrayfiledetails[sizeof($arrayfiledetails) - 1];
$_FILES['picture']['name'] = $session->applicant_id . '.' . $extension;
if ($photograph->attach_file($_FILES['picture'])) {
    $photograph->caption = User::applicant_fullname($session->applicant_id);
    $photograph->applicant_id = $session->applicant_id;
    //explode filename to get file extension
    $photograph->filename = $_FILES['picture']['name'];
    if ($photograph->save()) {
        $user = new User();
        $user->applicant_id = $session->applicant_id;
        $user->updateProgress('G');
        sleep(2);
        echo '<h4 class="alert alert-success"><i class="iconic-o-check" style="color: #51A351"></i> Success</h4>';
        echo '<hr>';
        echo 'Your <span style=" font-weight: bold; text-shadow: 1px 1px 4px #51A351;">Passport</span> has been successfully uploaded';
        echo '<br><hr>';
    } else {
        sleep(2);
        echo '<h4 class="alert alert-error"><i class="iconic-o-x" style="color: red"></i> Error!</h4>';
        echo '<hr>';
        echo 'Your <span style=" font-weight: bold; text-shadow: 1px 1px 4px red;">Passport</span> was not uploaded, due to some errors';
        echo '<br><hr>';
    }
开发者ID:Ghaji,项目名称:form_application,代码行数:31,代码来源:ajax_passport.php

示例5: Photograph

}
$max_file_size = 1048576;
// expressed in bytes
//     10240 =  10 KB
//    102400 = 100 KB
//   1048576 =   1 MB
//  10485760 =  10 MB
if (isset($_POST['submit']) && $_FILES['file_upload']['size'] != 0 && $_FILES['file_upload2']['size'] != 0) {
    $photo = new Photograph();
    $photo->attach_file($_FILES['file_upload']);
    $photo->description = $_POST['description'];
    $photo->category = $_POST['category'];
    $photo2 = new Photograph2();
    $photo2->attach_file($_FILES['file_upload2']);
    $photo2->category = $_POST['category'];
    if ($photo->save() && $photo2->save()) {
        // Success
        $session->message("Photographs uploaded successfully.");
        redirect_to('index.php');
    } else {
        // Failure
        $message = join("<br />Errror", $photo->errors);
    }
}
?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Upload Page</title>
开发者ID:dylan18595,项目名称:Picter,代码行数:31,代码来源:photo_upload.php

示例6: join

        $message1 = "Photographs was successfully uploaded";
    } else {
        $message1 = join("<br>", $photo->errors);
    }
    $photo1 = new Photograph();
    $photo1->hotel_id = $_GET['id'];
    $photo1->attach_file($_FILES['upload_file1']);
    if ($photo1->save()) {
        $message2 = "Photographs was successfully uploaded";
    } else {
        $message2 = join("<br>", $photo1->errors);
    }
    $photo2 = new Photograph();
    $photo2->hotel_id = $_GET['id'];
    $photo2->attach_file($_FILES['upload_file2']);
    if ($photo2->save()) {
        $message3 = "Photographs was successfully uploaded";
    } else {
        $message3 = join("<br>", $photo1->errors);
    }
}
?>

<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
	
开发者ID:kochevRisto,项目名称:project,代码行数:29,代码来源:test3.php


注:本文中的Photograph::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。