本文整理汇总了PHP中Photo::storeFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::storeFile方法的具体用法?PHP Photo::storeFile怎么用?PHP Photo::storeFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Photo
的用法示例。
在下文中一共展示了Photo::storeFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: testPhotoPng
function testPhotoPng()
{
$a = new Activite();
$a->slug = 'imagick-png';
$a->debut = new Zend_Db_Expr('CURRENT_TIMESTAMP');
$a->fin = new Zend_Db_Expr('CURRENT_TIMESTAMP');
$a->save();
$c = new Commentaire();
$c->message = '';
$c->save();
$o = new Photo();
$o->activite = $a->id;
$o->commentaires = $c->id;
$o->slug = 'photo-png';
$o->storeFile(dirname(__FILE__) . '/images/transparente.png');
}