本文整理汇总了PHP中Photo类的典型用法代码示例。如果您正苦于以下问题:PHP Photo类的具体用法?PHP Photo怎么用?PHP Photo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Photo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: afficherListePhotos
function afficherListePhotos()
{
//requete sql
if ($this->numpara) {
$result = mysql_query("SELECT numphoto,legende,numparaphoto FROM if_para_photo WHERE numpara='{$this->numpara}' ORDER BY ordre");
while ($row = mysql_fetch_row($result)) {
$unePhoto = new Photo();
$unePhoto->numphoto = $row[0];
$unePhoto->legendePhoto = $row[1];
$unePhoto->numparaphoto = $row[2];
$unePhoto->infosPhoto();
$this->photos[] = $unePhoto;
}
} else {
$result = mysql_query("SELECT numphoto FROM if_photo ORDER BY nom_photo");
while ($row = mysql_fetch_row($result)) {
$unePhoto = new Photo();
$unePhoto->numphoto = $row[0];
$unePhoto->infosPhoto();
$this->photos[] = $unePhoto;
}
}
if (count($this->photos) >= 1) {
return true;
}
}
开发者ID:rcampistron,项目名称:ParagrapheCMS,代码行数:26,代码来源:ListePhotos.inc.php
示例2: privacy_image_cache_init
function privacy_image_cache_init()
{
$urlhash = 'pic:' . sha1($_REQUEST['url']);
$r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $urlhash);
if (count($r)) {
$img_str = $r[0]['data'];
$mime = $r[0]["desc"];
if ($mime == "") {
$mime = "image/jpeg";
}
} else {
require_once "Photo.php";
$img_str = fetch_url($_REQUEST['url'], true);
if (substr($img_str, 0, 6) == "GIF89a") {
$mime = "image/gif";
$image = @imagecreatefromstring($img_str);
if ($image === FALSE) {
die;
}
q("INSERT INTO `photo`\n\t\t\t( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, `album`, `height`, `width`, `desc`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )\n\t\t\tVALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' )", 0, 0, get_guid(), dbesc($urlhash), dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc(basename(dbesc($_REQUEST["url"]))), dbesc(''), intval(imagesy($image)), intval(imagesx($image)), 'image/gif', dbesc($img_str), 100, intval(0), dbesc(''), dbesc(''), dbesc(''), dbesc(''));
} else {
$img = new Photo($img_str);
if ($img->is_valid()) {
$img->store(0, 0, $urlhash, $_REQUEST['url'], '', 100);
$img_str = $img->imageString();
}
$mime = "image/jpeg";
}
}
header("Content-type: {$mime}");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 3600 * 24) . " GMT");
header("Cache-Control: max-age=" . 3600 * 24);
echo $img_str;
killme();
}
开发者ID:robhell,项目名称:friendica-addons,代码行数:35,代码来源:privacy_image_cache.php
示例3: __construct
public function __construct()
{
gateKeeper();
$user = getLoggedInUser();
$user->createAvatar();
if (isEnabledPlugin("photos")) {
$album = getEntity(array("type" => "Photoalbum", "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()), array("name" => "title", "value" => "Profile Avatars"))));
$photo = new Photo();
$photo->owner_guid = getLoggedInUserGuid();
$photo_guid = $photo->save();
Image::copyAvatar($user, $photo);
$photo = getEntity($photo_guid);
if (!$album) {
$album = new Photoalbum();
$album->owner_guid = getLoggedInUserGuid();
$album->title = "Profile Avatars";
$album_guid = $album->save();
$album = getEntity($album_guid);
Image::copyAvatar($photo, $album);
}
$photo->container_guid = $album->guid;
$photo->save();
}
runHook("action:edit_avatar:after", array("user" => $user));
new Activity(getLoggedInUserGuid(), "activity:avatar:updated", array($user->getURL(), $user->full_name));
new SystemMessage("Your avatar has been uploaded.");
forward("profile/" . $user->guid);
}
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:28,代码来源:EditAvatarActionHandler.php
示例4: homepageimageeditAction
public function homepageimageeditAction()
{
global $mySession;
$db = new Db();
$id = $this->getRequest()->getParam('id');
$sql = "SELECT image_text FROM " . HOMEPAGEIMG . " WHERE id = {$id}";
// prd($sql);
$record = $db->runQuery($sql);
$this->view->id = $id;
$myform = new Form_Photo(1, $id);
$myform->populate($record[0]);
$this->view->pageHeading = "Edit image";
if ($this->getRequest()->isPost()) {
$request = $this->getRequest();
if ($myform->isValid($request->getPost())) {
$dataForm = $myform->getValues();
$myObj = new Photo();
$Result = $myObj->Savehpi($dataForm, $id);
if ($Result == 1) {
$mySession->sucessMsg = "Image Updated updated successfully.";
$this->_redirect('photo/homepageimage');
} else {
$mySession->errorMsg = "Image name you entered is already exists.";
}
}
}
$this->view->myform = $myform;
}
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:28,代码来源:PhotoController.php
示例5: __construct
public function __construct()
{
$editor = getInput("editor_id");
if (file_exists($_FILES['avatar']['tmp_name'])) {
// Check if General album exists
$album = getEntity(array("type" => "Photoalbum", "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()), array("name" => "title", "value" => "General"))));
$photo = new Photo();
$photo->owner_guid = getLoggedInUserGuid();
$photo->save();
$photo->createAvatar();
if (!$album) {
$album = new Photoalbum();
$album->title = "General";
$album->owner_guid = getLoggedInUserGuid();
$album->access_id = "public";
Image::copyAvatar($photo, $album);
$album->save();
}
$photo->container_guid = $album->guid;
if (!$album->title != "Profile Avatars" && $album->title != "General") {
new Activity(getLoggedInUserGuid(), "activity:add:photo", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $album->getURL(), $album->title, "<a href='" . $album->getURL() . "'>" . $photo->icon(EXTRALARGE, "img-responsive") . "</a>"), $album->access_id);
}
$photo->save();
forward(false, array("insertphoto" => $photo->guid, "editor" => $editor));
} else {
forward();
}
}
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:28,代码来源:UploadPhotoActionHandler.php
示例6: post_new
public function post_new()
{
$rules = array('title' => 'required|min:5|max:128', 'street' => 'required', 'postalcode' => 'required|match:#^[1-9][0-9]{3}\\h*[A-Z]{2}$#i', 'city' => 'required', 'type' => 'required', 'surface' => 'required|integer', 'price' => 'required|numeric|max:1500|min:100', 'date' => 'required|after:' . date('d-m-Y'), 'pictures' => 'required|image|max:3000', 'register' => 'required', 'email' => 'required|email|same:email2', 'description' => 'required|min:30', 'captchatest' => 'laracaptcha|required', 'terms' => 'accepted');
$v = Validator::make(Input::all(), $rules, Room::$messages);
if ($v->fails()) {
return Redirect::to('kamer-verhuren')->with_errors($v)->with('msg', '<div class="alert alert-error"><strong>Verplichte velden zijn niet volledig ingevuld</strong><br />Loop het formulier nogmaals na.</div>')->with_input();
} else {
if (Auth::check()) {
$status = 'publish';
} else {
$status = 'pending';
}
$new_room = array('title' => ucfirst(Input::get('title')), 'street' => ucwords(Input::get('street')), 'housenr' => Input::get('housenr'), 'postalcode' => Input::get('postalcode'), 'city' => ucwords(Input::get('city')), 'type' => Input::get('type'), 'surface' => Input::get('surface'), 'price' => Input::get('price'), 'available' => date("Y-m-d", strtotime(Input::get('date'))), 'gender' => Input::get('gender'), 'pets' => Input::get('pets'), 'smoking' => Input::get('smoking'), 'toilet' => Input::get('toilet'), 'shower' => Input::get('shower'), 'kitchen' => Input::get('kitchen'), 'register' => Input::get('register'), 'social' => Input::get('social'), 'email' => strtolower(Input::get('email')), 'description' => ucfirst(Input::get('description')), 'status' => $status, 'url' => Str::slug(Input::get('city')), 'delkey' => Str::random(32, 'alpha'), 'del_date' => date('y-m-d', strtotime('+2 months')));
$room = new Room($new_room);
if ($room->save()) {
$upload_path = path('public') . Photo::$upload_path_room . $room->id;
if (!File::exists($upload_path)) {
File::mkdir($upload_path);
chmod($upload_path, 0777);
}
$photos = Photo::getNormalizedFiles(Input::file('pictures'));
foreach ($photos as $photo) {
$filename = md5(rand()) . '.jpg';
$path_to_file = $upload_path . '/' . $filename;
$dynamic_path = '/' . Photo::$upload_path_room . $room->id . '/' . $filename;
$success = Resizer::open($photo)->resize(800, 533, 'auto')->save($path_to_file, 80);
chmod($path_to_file, 0777);
if ($success) {
$new_photo = new Photo();
$new_photo->location = $dynamic_path;
$new_photo->room_id = $room->id;
$new_photo->save();
}
}
Message::send(function ($message) use($room) {
$message->to($room->email);
$message->from('[email protected]', 'Kamergenood');
$message->subject('In afwachting op acceptatie: "' . $room->title . '"');
$message->body('view: emails.submit');
$message->body->id = $room->id;
$message->body->title = $room->title;
$message->body->price = $room->price;
$message->body->type = $room->type;
$message->body->surface = $room->surface;
$message->body->available = $room->available;
$message->body->description = $room->description;
$message->body->url = $room->url;
$message->body->delkey = $room->delkey;
$message->html(true);
});
if (Message::was_sent()) {
return Redirect::to('kamer-verhuren')->with('msg', '<div class="alert alert-success"><strong>Hartelijk dank voor het vertrouwen in Kamergenood!</strong> De kameradvertentie zal binnen 24 uur worden gecontroleerd en geplaatst.</div>');
}
} else {
return Redirect::to('kamer-verhuren')->with('msg', '<div class="alert alert-error"><strong>Er is iets mis gegaan bij het toevoegen.</strong> Probeer het later nog eens.</div>')->with_input();
}
}
}
开发者ID:sanneterpstra,项目名称:Kamergenood,代码行数:58,代码来源:rooms.php
示例7: actionPhoto
public function actionPhoto()
{
$model = new Photo('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Photo'])) {
$model->attributes = $_GET['Photo'];
}
$this->render('photo', compact('model'));
}
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:10,代码来源:ListController.php
示例8: fetch
function fetch($annee = NULL)
{
if (!$this->activite) {
return array('activites' => $this->unite->findActivites($annee));
} else {
$this->controller->assert(null, $this->activite, 'envoyer-photo', "Vous n'avez pas le droit d'envoyer de photo de " . $this->activite->getIntituleComplet() . ".");
}
$m = new Wtk_Form_Model('envoyer');
$i = $m->addString('titre', 'Titre');
$m->addConstraintRequired($i);
$m->addFile('photo', "Photo");
$m->addString('commentaire', 'Votre commentaire');
$m->addBool('envoyer', "J'ai d'autres photos à envoyer", true);
$m->addNewSubmission('envoyer', "Envoyer");
$t = new Photos();
if ($m->validate()) {
$p = new Photo();
$p->titre = $m->titre;
$p->slug = $t->createSlug(wtk_strtoid($m->titre));
$p->activite = $this->activite->id;
$action = $m->envoyer ? 'envoyer' : 'consulter';
$c = new Commentaire();
$c->auteur = Zend_Registry::get('individu')->id;
$c->message = $m->commentaire;
$db = $t->getAdapter();
$db->beginTransaction();
try {
$c->save();
$p->commentaires = $c->id;
$p->save();
$i = $m->getInstance('photo');
if ($i->isUploaded()) {
$tmp = $i->getTempFilename();
$p->storeFile($tmp);
}
$url = $this->controller->_helper->Url('voir', 'photos', null, array('photo' => $p->slug), true);
$this->controller->logger->info("Photo envoyée", $url);
foreach ($this->activite->findUnitesParticipantesExplicites() as $u) {
$ident = new Identification();
$ident->photo = $p->id;
$ident->unite = $u->id;
$ident->save();
$this->controller->logger->info("Unité identifiée sur une photo", $url);
}
$db->commit();
} catch (Exception $e) {
$db->rollBack();
throw $e;
}
$this->controller->_helper->Flash->info("Photo envoyée");
$this->controller->redirectSimple($action, null, null, array('album' => $this->activite->slug));
}
$photos = $this->activite->findPhotos($t->select()->order('date'));
return array('unite' => $this->unite, 'annee' => $annee, 'model' => $m, 'activite' => $this->activite, 'photos' => $photos);
}
开发者ID:bersace,项目名称:strass,代码行数:55,代码来源:PhotosEnvoyer.php
示例9: getPhotos
public static function getPhotos($object, $idalbum)
{
$sql = "SELECT * FROM photos WHERE idalbum=" . $idalbum;
$rs = DataBase::ExecuteQuery($sql, "ARRAY");
foreach ($rs as $key => $value) {
$photo = new Photo();
$photo->setPhoto($value['idphoto'], $value['name'], $value['src'], $value['title'], $value['idalbum'], $value['fecha']);
array_push($object, $photo);
}
return $object;
}
开发者ID:risos007,项目名称:thechurch,代码行数:11,代码来源:Photo.class.php
示例10: supprimerphotoAction
public function supprimerphotoAction()
{
if (isset($_GET['id'])) {
$photo = new Photo();
$selectlaphoto = $photo->selectOne($_GET['id']);
$photoname = $selectlaphoto['nomPhoto'];
exec('rm ' . APPLICATION_PATH . '/../public/imgNao/' . $selectlaphoto['nomPhoto'], $output, $return);
$laphoto = $photo->find($_GET['id'])->current();
$laphoto->delete();
$this->_redirect('/photovideo/photo');
}
}
开发者ID:Cydev2306,项目名称:Nao-App,代码行数:12,代码来源:PhotovideoController.php
示例11: addPhoto
/**
* @brief Function addPhoto
* insere no banco uma nova foto, sendo o endereço novo ou o passado como parametro.
* @param id_adm do usuario logado
* @return mensagem indicador de erro ou sucesso
*/
public function addPhoto($id_adm)
{
$name = Photo::getSendName();
/* Guarda diretorio com novo nome e envia a imagem */
if (is_array($name) && array_key_exists('ERRO', $name)) {
/* Verificando se eh o nome da imagem ou a mensagem de erro */
return $name['ERRO'];
} else {
$morephoto = new Photo();
$morephoto->albumName = $this->name;
return $morephoto->set($id_adm, Dbcommand::getServer() . $name);
}
}
开发者ID:cassiod,项目名称:SisAdm,代码行数:19,代码来源:Album.class.php
示例12: getPhotos
/**
* @param String $url
* @param int $id
* @return Photo[]
*/
public static function getPhotos($url)
{
$xh = new XMLHandler($url);
$photoItems = $xh->getNodes("photo");
$photoList = array();
foreach ($photoItems as $photoNode) {
$p = new Photo();
$p->setId($photoNode->getElementsByTagName("id")->item(0)->textContent);
$p->setAlt($photoNode->getElementsByTagName("htmlAlt")->item(0)->textContent);
$p->setOrientation($photoNode->getElementsByTagName("orientation")->item(0)->textContent);
//set thumbnail pic and large pic
$photoInstancesNode = $photoNode->getElementsByTagName("instance");
foreach ($photoInstancesNode as $pi) {
$type = $pi->getElementsByTagName("type")->item(0)->textContent;
/* @var $pi DomElement */
if ($type == "Thumbnail") {
$p->getThumb()->parsePhotoInstance($pi);
} elseif ($type == "Large") {
$p->getLarge()->parsePhotoInstance($pi);
} elseif ($type == "HighRes") {
$p->getHiRes()->parsePhotoInstance($pi);
} elseif ($type == "Custom") {
$p->getCustom()->parsePhotoInstance($pi);
}
}
$photoList[] = $p;
}
return $photoList;
}
开发者ID:ContentLEAD,项目名称:BraftonJoomla3Component,代码行数:34,代码来源:Photo.php
示例13: savePhoto
/**
*新的的话就要新建一个guide,旧的的话就是要将photo直接保存即可
*/
public function savePhoto(Photo &$photo)
{
if ($this->isNewRecord) {
$this->title = Scenic::model()->findByPk($photo->scenicId);
$this->userId = Yii::app()->user->userId;
$this->save();
$photo->guideId = $this->guideId;
$photo->save();
} else {
if ($photo->save()) {
$this->save();
}
}
}
开发者ID:tiger2soft,项目名称:travelman,代码行数:17,代码来源:Guide.php
示例14: addPhoto
public function addPhoto($userId, $filePath)
{
$photo = new Photo();
$photo->user_id = $userId;
$photo->photo_album_id = $this->id;
$photo->file_path = $filePath;
$saved = $photo->save();
if ($saved) {
if (count($this->photos) === 1) {
$this->saveAttributes(array('cover_photo_id' => $photo->id));
}
return $photo;
}
return null;
}
开发者ID:jayrulez,项目名称:yiisns,代码行数:15,代码来源:PhotoAlbum.php
示例15: converseToModel
/**
* Añade datos de la ultima foto cargda (Zend_Gdata_Photos_PhotoFeed)
* al modelo Photo.
*
* @return Photo
*/
public static function converseToModel()
{
$picasa = new Neo_Gdata_Photo();
$photo = $picasa->getLastPhotoUpload();
$foto = new Photo();
$foto->photo_id = $photo->getGphotoId();
$foto->titulo = $photo->getTitle();
$foto->descripcion = $photo->getMediaGroup()->getDescription();
$thumbnail = $photo->getMediaGroup()->getThumbnail();
$foto->thumbnail_1 = $thumbnail[0]->getUrl();
$foto->thumbnail_2 = $thumbnail[1]->getUrl();
$foto->thumbnail_3 = $thumbnail[2]->getUrl();
$foto->save();
return $foto;
}
开发者ID:Neozeratul,项目名称:Intermodels,代码行数:21,代码来源:Photo.php
示例16: photo
static function photo($database, $plugins, $settings, $path, $albumID = 0, $description = '', $tags = '')
{
$info = getimagesize($path);
$size = filesize($path);
$photo = new Photo($database, $plugins, $settings, null);
$nameFile = array(array());
$nameFile[0]['name'] = $path;
$nameFile[0]['type'] = $info['mime'];
$nameFile[0]['tmp_name'] = $path;
$nameFile[0]['error'] = 0;
$nameFile[0]['size'] = $size;
if (!$photo->add($nameFile, $albumID, $description, $tags)) {
return false;
}
return true;
}
开发者ID:neynah,项目名称:Lychee,代码行数:16,代码来源:Import.php
示例17: postNewAdmin
public function postNewAdmin()
{
//verify the user input and create account
$validator = Validator::make(Input::all(), array('Identity_No' => 'required', 'Email' => 'required|email', 'Phone_Number' => 'required', 'First_Name' => 'required', 'Last_Name' => 'required', 'Photo_1' => 'image|required', 'Photo_2' => 'image|required', 'Photo_3' => 'image|required'));
if ($validator->fails()) {
return Redirect::route('super-admin-new-admin-get')->withErrors($validator)->withInput()->with('globalerror', 'Sorry!! The Data was not Saved, please retry');
} else {
$identitynumber = Input::get('Identity_No');
$email = Input::get('Email');
$phonenumber = Input::get('Phone Numer');
$firstname = Input::get('First_Name');
$lastname = Input::get('Last_Name');
$photo_1 = Input::file('Photo_1');
$photo_2 = Input::file('Photo_2');
$photo_3 = Input::file('Photo_3');
//register the new user
$newuser = User::create(array('Identity_No' => $identitynumber, 'First_Name' => $firstname, 'Last_Name' => $lastname, 'Password' => Hash::make($identitynumber), 'Active' => TRUE));
//register the new user contact
$newcontact = Contact::create(array('Email' => $email, 'Phone_Number' => $phonenumber));
//Save the three Photos
$photo1 = $this->postPhoto($photo_1);
$photo2 = $this->postPhoto($photo_2);
$photo3 = $this->postPhoto($photo_3);
$newphotos = Photo::create(array('photo_1' => $photo1, 'photo_2' => $photo2, 'photo_3' => $photo3));
//save the details to the students table
$newadmin = Admin::create(array('Users_Id' => $newuser->id, 'Contacts_Id' => $newcontact->id, 'Photos_Id' => $newphotos->id));
if ($newuser && $newcontact && $newphotos && $newadmin) {
return Redirect::route('super-admin-new-admin-get')->with('globalsuccess', 'New Admin Details Have been Added');
}
}
}
开发者ID:franqq,项目名称:Secure-Evoting-With-Face-Recognition,代码行数:31,代码来源:SuperAdminNavigationController.php
示例18: actionPhoto
public function actionPhoto()
{
$criteria = new CDbCriteria();
$criteria->limit = 25;
$model = Photo::model()->is_publish()->findAll($criteria);
$this->setRss($model, 'photo', 'Photo', 'Rss Feed Photo', $this->createUrl('photo'));
}
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:7,代码来源:RssController.php
示例19: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Photo::create([]);
}
}
开发者ID:Defoncesko,项目名称:iamhungry,代码行数:7,代码来源:PhotosTableSeeder.php
示例20: show
public static function show(Inputter $inputter, JSONOutputter $outputter)
{
// Show
//
$id = $inputter->additional_uri_arguments[0];
$error = null;
UniversallyUniqueIdentifier::propertyIsValid('rawIdentifier', $id, $error);
if (isset($error)) {
$outputter->print_error($error);
}
// User ID
//
$client = new Everyman\Neo4j\Client('events.sb04.stations.graphenedb.com', 24789);
$client->getTransport()->setAuth('Events', '3TP9LHROhv8LIcGmbYzq');
$query_string = 'MATCH (object:Photo)
WHERE object.' . UNIVERSALLY_UNIQUE_OBJECT_KEY_IDENTIFICATION . ' = \'' . $id . '\'
RETURN object';
$query = new Everyman\Neo4j\Cypher\Query($client, $query_string);
$result = $query->getResultSet();
if (count($result) > 0) {
// Compare sent data is equal to data retrieved
//
$object = $result[0]['object'];
// Print data
//
$outputter->print_data(array(Photo::printer_dictionary($object)));
} else {
// Throw error, user doesn't exists
//
$error = Error::withDomain(PRIVATE_EVENTS_REST_CONTROLLER_ERROR_DOMAIN, PRIVATE_EVENTS_REST_CONTROLLER_ERROR_CODE_ENTITY_DOES_NOT_EXIST, 'Photo with ID does not exist.');
$outputter->print_error($error);
}
}
开发者ID:adamcarter93,项目名称:university-final-year-project-rest-api,代码行数:33,代码来源:photos.php
注:本文中的Photo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论