本文整理汇总了PHP中Picture类的典型用法代码示例。如果您正苦于以下问题:PHP Picture类的具体用法?PHP Picture怎么用?PHP Picture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Picture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:40,代码来源:PictureMapper.class.php
示例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);
}
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:25,代码来源:error-template.php
示例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;
}
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:10,代码来源:header.php
示例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);
}
开发者ID:simplator,项目名称:medialib,代码行数:15,代码来源:-FileController.php
示例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();
}
开发者ID:EricBui0512,项目名称:FYP,代码行数:10,代码来源:ImageTableSeeder.php
示例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', '');
}
}
开发者ID:christine-ho-dev,项目名称:movim,代码行数:10,代码来源:Avatar.php
示例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');
}
}
开发者ID:tigron,项目名称:skeleton-file-picture,代码行数:16,代码来源:Manipulation.php
示例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;
}
开发者ID:developdms,项目名称:Practica-5,代码行数:14,代码来源:ManagerPicture.php
示例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);
}
开发者ID:Hywan,项目名称:moxl,代码行数:14,代码来源:Avatar.php
示例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']);
}
开发者ID:Jv-Juven,项目名称:opera-1,代码行数:27,代码来源:PicturesTableSeeder.php
示例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));
}
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:27,代码来源:AdminController.php
示例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();
}
开发者ID:terminal42,项目名称:contao-pageimage,代码行数:32,代码来源:ModulePageImage.php
示例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();
}
开发者ID:netfox01,项目名称:exprime,代码行数:7,代码来源:Picture.php
示例14: loadModel
public function loadModel($id)
{
if (($model = Picture::model()->findByPk($id)) === null) {
throw new CHttpException(404, 'Страница не найдена');
}
return $model;
}
开发者ID:kuzmina-mariya,项目名称:gallery,代码行数:7,代码来源:PictureBackendController.php
示例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));
}
开发者ID:Jv-Juven,项目名称:opera-1,代码行数:7,代码来源:UserPageController.php
示例16: run
public function run()
{
$models = Picture::model()->published()->onMainPage()->with('category')->findAll(array('order' => 'category.sort ASC, t.sort ASC', 'limit' => (int) $this->limit));
if (empty($models)) {
return;
}
$this->render($this->view, array('models' => $models));
}
开发者ID:kuzmina-mariya,项目名称:gallery,代码行数:8,代码来源:PortfolioWidget.php
示例17: getFileSrc
public function getFileSrc()
{
if (!$this->isNew()) {
return Picture::getInstance('', $this->getObject()->getPicture(), '', 50, 50)->getRawLink('resize');
} else {
return '';
}
}
开发者ID:vcgato29,项目名称:poff,代码行数:8,代码来源:BannerForm.class.php
示例18: __construct
/**
* 构造函数
* @param int $pic_id 图片ID
* @param int|bool $page 当前页面数
* @param array $info 图片的相关信息
* @throws \Exception
*/
function __construct($pic_id, $page = false, $info = NULL)
{
parent::__construct("pictures_has_comments", "pictures_id", intval($pic_id), "pictures");
$this->page = intval($page);
$this->action_method = "post_picture";
$this->router = lib()->using('router');
if ($info === NULL) {
lib()->load('Picture');
$pic = new Picture();
$this->picture_info = $pic->get_simple_pic($pic_id);
} else {
$this->picture_info = $info;
}
if (!isset($this->picture_info['pic_id'])) {
throw new \Exception("Picture comment load error.");
}
}
开发者ID:ttym7993,项目名称:Linger,代码行数:24,代码来源:PictureComment.php
示例19: smarty_modifier_psize
/**
* Smarty page modifier plugin
*
* Type: modifier<br>
* Name: psize<br>
* Date: Oct 14, 2008
* Purpose: get size of picture
* Example: {$url|psize:0}
* @version 1.0
* @param (string) $url| 图片的url地址
* @param (int) $type| 需要返回的类型:0表示宽,1表示高
* @return (int) 返回指定类型的大小
*/
function smarty_modifier_psize($url, $type = 0)
{
$size = Picture::GetSize($url, $type);
if (0 == $type) {
return $size['width'];
} else {
return $size['height'];
}
}
开发者ID:cmooony,项目名称:d4d-studio,代码行数:22,代码来源:modifier.psize.php
示例20: getFileSrc
public function getFileSrc($pic)
{
$method = $pic == 'picture' ? 'getPicture' : 'getPictureInactive';
if (!$this->isNew() && $this->getObject()->{$method}()) {
return Picture::getInstance('', $this->getObject()->{$method}(), '', 50, 50)->getRawLink('resize');
} else {
return '';
}
}
开发者ID:vcgato29,项目名称:poff,代码行数:9,代码来源:ProductGroupForm.class.php
注:本文中的Picture类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论