本文整理汇总了PHP中Picture类的典型用法代码示例。如果您正苦于以下问题:PHP Picture类的具体用法?PHP Picture怎么用?PHP Picture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Picture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePicture
/**
*
* @param Picture $picture_
* @throws InvalidArgumentException
*/
public function updatePicture(Picture $picture_)
{
try {
if (isset($this->table) && is_null($this->table)) {
throw new InvalidArgumentException('Attribute "table" can\'t be NULL !');
}
if (isset($this->id) && !is_null($this->id)) {
$where = 'id = ' . $this->id;
}
//Existance test
$picture = $this->selectPicture();
if (!emptyObjectMethod($picture)) {
$picture = $this->selectPicture();
$path = $picture->getPath();
$title = $picture->getTitle();
$ext = $picture->getExtension();
if (file_exists(UPLOAD_PATH . $path . $title . '.' . $ext)) {
if (!is_null($picture_->getTitle()) && $title !== $picture_->getTitle()) {
if (!rename(UPLOAD_PATH . $path . $title . '.' . $ext, UPLOAD_PATH . $path . $picture_->getTitle() . '.' . $ext)) {
throw new Exception('A problem occurred when renaming !');
}
}
}
} else {
throw new Exception('Picture doesn\'t exist !');
}
return parent::update($this->table, $picture_, $where);
} catch (InvalidArgumentException $e) {
print $e->getMessage();
exit;
} catch (Exception $e) {
print $e->getMessage();
exit;
}
}
示例2: __construct
function __construct($content, $title)
{
parent::__construct();
define(GOOGLE_CODE_TRACKER_NOT_ACTIF, true);
$this->render = new Table();
$this->render->setWidth("100%");
// Header
if (defined('SITE_META_OPENGRAPH_IMAGE') && SITE_META_OPENGRAPH_IMAGE != "") {
$logo = new Picture(SITE_META_OPENGRAPH_IMAGE);
} else {
$logo = new Picture("img/logo_128x400_" . $_SESSION['lang'] . ".png", 128, 400);
}
$logo->setTitle(__(SITE_NAME));
$logo_link = new Link($this->getPage()->getBaseLanguageURL(), Link::TARGET_NONE, $logo);
$img_obj = new Object($logo_link);
$img_obj->add("<br/><br/>");
$this->render->addRow($img_obj);
$this->render->addRow();
// Error message
$small_img = new Picture("wsp/img/warning_16.png", 16, 16, 0, "absmiddle");
$title_header = new Object($small_img, $title);
$error_box = new Box($title_header, true, Box::STYLE_MAIN, Box::STYLE_MAIN, '', 'error_box', 700);
$error_box->setContent($content);
$this->render->addRow($error_box);
}
示例3: __construct
function __construct()
{
// Header
$logo = new Picture("img/logo_128x400_" . $_SESSION['lang'] . ".png", 128, 400);
$logo->setTitle(__(SITE_NAME));
$logo_link = new Link(BASE_URL . $_SESSION['lang'] . "/", Link::TARGET_NONE, $logo);
$img_obj = new Object($logo_link);
$img_obj->add("<br/><br/>");
$this->render = $img_obj;
}
示例4: actionPicture
/**
* Displays a single Picture model.
* @param integer $id
* @return mixed
*/
public function actionPicture($id, $size = 'full')
{
if (($model = Picture::findOne($id)) === null) {
throw new NotFoundHttpException('The requested page does not exist.');
}
if (!$model) {
$model = new Picture();
}
$this->redirect($model->directlink($size), 301);
}
示例5: run
public function run()
{
DB::statement("TRUNCATE TABLE images");
$image = new Picture();
$image->image_path = 'asset/upload/D4C21840-5F68-48EA-A63E-7AC4C3D9B43A.JPG';
$image->created_at = new DateTime();
$image->updated_at = new DateTime();
$image->big_path = 'asset/upload/D4C21840-5F68-48EA-A63E-7AC4C3D9B43A.JPG';
$image->save();
}
示例6: display
function display()
{
$p = new Picture();
if (!$p->get($this->user->getLogin())) {
$this->view->assign('getavatar', $this->call('ajaxGetAvatar'));
$this->view->assign('form', $this->prepareForm(new \modl\Contact()));
} else {
$this->view->assign('getavatar', '');
}
}
示例7: load
/**
* Load image
*
* @access private
* @param Picture $picture
*/
private function load(Picture $picture)
{
$this->width = $picture->width;
$this->height = $picture->height;
$this->mime_type = $picture->mime_type;
$this->image = $this->open($picture->get_path());
if ($this->image === false) {
throw new \Exception('Is not a valid picture');
}
}
示例8: getList
function getList($params = NULL, $proyection = '*', $order = '1', $limit = '')
{
if ($this->db != NULL) {
$this->db->read($this->table, $proyection, $params);
$r = array();
while ($param = $this->db->getRow()) {
$picture = new Picture();
$picture->set($param);
$r[] = $picture;
}
return $r;
}
return NULL;
}
示例9: handle
public function handle($stanza, $parent = false)
{
$jid = current(explode('/', (string) $parent->attributes()->from));
$evt = new \Event();
$cd = new \modl\ContactDAO();
$c = $cd->get($jid);
if ($c == null) {
$c = new \modl\Contact();
}
$p = new \Picture();
$p->fromBase((string) $stanza->items->item->data);
$p->set($jid);
$evt->runEvent('vcard', $c);
}
示例10: run
public function run()
{
Picture::create(['album_id' => 1, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_03.png']);
Picture::create(['album_id' => 1, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_03.png']);
Picture::create(['album_id' => 1, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_03.png']);
Picture::create(['album_id' => 1, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_03.png']);
Picture::create(['album_id' => 5, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 5, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 5, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 5, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 9, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 9, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 9, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 9, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
Picture::create(['album_id' => 13, 'title' => '戏剧人生', 'picture' => 'http://7xk6xh.com1.z0.glb.clouddn.com/album_05.png']);
}
示例11: getIndex
public function getIndex()
{
if (Auth::guest() || Auth::user()->isAdmin == 0) {
return Redirect::secure('/');
}
// layouts variables
$this->layout->title = 'Админ панел | Нещо Шантаво';
$this->layout->canonical = 'https://neshto.shantavo.com/admin/';
$this->layout->robots = 'noindex,nofollow,noodp,noydir';
$users = count(User::all());
$admins = count(User::where('isAdmin', ">", 0)->get());
$categories = count(Category::all());
$albums = count(Album::all());
$votes = count(DB::table('votes')->get());
$pictures = count(Picture::all());
$pictureSize = 0;
foreach (Picture::all() as $p) {
$pictureSize += $p->size;
}
// get disqus stats
include app_path() . '/config/_disqus.php';
$disqus = new DisqusAPI(getDisqusKey());
$disqus->setSecure(false);
$comments = $disqus->posts->list(array('forum' => 'shantavo'));
// nesting the view into the layout
$this->layout->nest('content', 'admin.index', array('users' => $users, 'admins' => $admins, 'votes' => $votes, 'categories' => $categories, 'albums' => $albums, 'pictures' => $pictures, 'pictureSize' => $pictureSize, 'comments' => $comments));
}
示例12: compile
protected function compile()
{
if ($this->defineRoot) {
$objPage = \PageModel::findByPk($this->rootPage);
} else {
global $objPage;
}
if (null === $objPage) {
return;
}
$intOffset = (int) $this->levelOffset;
// Random image
if ($this->randomPageImage) {
$intOffset = -1;
}
$arrImage = PageImage::getOne($objPage, $intOffset, (bool) $this->inheritPageImage);
if (null === $arrImage) {
return;
}
$arrSize = deserialize($this->imgSize);
$arrImage['src'] = $this->getImage($arrImage['path'], $arrSize[0], $arrSize[1], $arrSize[2]);
$this->Template->setData($arrImage);
$picture = \Picture::create($arrImage['path'], $arrSize)->getTemplateData();
$picture['alt'] = specialchars($arrImage['alt']);
$this->Template->picture = $picture;
if (($imgSize = @getimagesize(TL_ROOT . '/' . rawurldecode($arrImage['src']))) !== false) {
$this->Template->size = ' ' . $imgSize[3];
}
// Add page information to template
global $objPage;
$this->Template->currentPage = $objPage->row();
}
示例13: isLiked
public function isLiked($user_id)
{
$picture = $this;
return Picture::whereHas('likes', function ($q) use($picture, $user_id) {
$q->whereRaw('user_id = ? and picture_id = ?', array($user_id, $picture->id));
})->exists();
}
示例14: loadModel
public function loadModel($id)
{
if (($model = Picture::model()->findByPk($id)) === null) {
throw new CHttpException(404, 'Страница не найдена');
}
return $model;
}
示例15: gallary
public function gallary()
{
$album_id = Input::get("album_id");
$user_id = Input::get("user_id");
$photos = Picture::where("album_id", "=", $album_id)->get();
return View::make('userCenter.gallary')->with(array("photos" => $photos, "user_id" => $user_id, "album_id" => $album_id));
}