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


PHP Photo::find方法代码示例

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


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

示例1: get_delete

 public function get_delete($id, $redirect = null)
 {
     $photo = Photo::find($id);
     $photo->delete();
     if (is_null($redirect)) {
         return Redirect::to('admin/cityphotos')->with('msg', '<div class="alert alert-success"><strong>Foto verwijderd</strong></div>');
     }
 }
开发者ID:sanneterpstra,项目名称:Kamergenood,代码行数:8,代码来源:photo.php

示例2: viewDetails

 public function viewDetails($id)
 {
     $photo = Photo::find($id);
     if ($photo === null) {
         $error = 'No such photo found.';
         return View::make('errors.error', array('errorMsg' => $error));
     }
     $comments = Comment::where('photo_id', '=', $photo->id)->with('author')->get();
     return View::make('photo.details', array('photo' => $photo, 'comments' => $comments));
 }
开发者ID:renankabal,项目名称:image-manager-system,代码行数:10,代码来源:PhotoController.php

示例3: 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

示例4: postPhotoComment

 public function postPhotoComment($id)
 {
     $photo = Photo::find($id);
     if ($photo === null) {
         $error = 'Can not post comment. No such photo found.';
         return View::make('errors.error', array('errorMsg' => $error));
     }
     $input = Input::all();
     $comment = new Comment(['content' => $input['content'], 'author_id' => Auth::user()->id, 'photo_id' => $id]);
     $comment->save();
     return Redirect::to('/photo/' . $id);
 }
开发者ID:renankabal,项目名称:image-manager-system,代码行数:12,代码来源:CommentsController.php

示例5: getPhotos

 public function getPhotos()
 {
     $user = $this->request->user();
     $profile = $user->profile;
     $gender = $profile->gender;
     $photos = $user->photos()->get();
     if ($user->photo_id) {
         $photo = Photo::find($user->photo_id);
         $image = $photo->image->url('medium');
     } else {
         $path = public_path();
         $image = $path . ($gender ? '/img/avatars/' . $gender . sprintf('%02d', rand(1, 24)) . '.jpg' : '/img/avatars/user-default.jpg');
     }
     return view('mypage.photos', compact('profile', 'photos', 'image'));
 }
开发者ID:jinseokoh,项目名称:ask,代码行数:15,代码来源:MyPageController.php

示例6: dropphoto

 public function dropphoto()
 {
     $lokasi = public_path() . '/photos';
     $getId = Input::get('id');
     if (!empty($getId)) {
         $delete = Photo::find($getId);
         $delete->delete();
         try {
             unlink($lokasi . $getId . '_t.jpg');
             unlink($lokasi . $getId . '.jpg');
             return "ok";
         } catch (Exception $e) {
             return "nothing _t.jpg";
         }
     }
 }
开发者ID:marthem,项目名称:bagikasih,代码行数:16,代码来源:AdminSocialTargetController.php

示例7: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $photo = Photo::find($id);
     //delete photos with thumbnails from file and photo from db
     foreach (Photo::getThumbnailSizes() as $key => $thumb) {
         File::delete(public_path('/uploads/' . $photo->user_id . "/") . $key . "-" . $photo->name);
     }
     File::delete(public_path('/uploads/' . $photo->user_id . "/") . $photo->name);
     $photo->delete();
     $results = array($photo->name => true);
     return json_encode(array('files' => $results));
 }
开发者ID:shankargiri,项目名称:Quantum-Vic-La-Trobe-L4,代码行数:18,代码来源:PhotosController.php

示例8: url

<?
if ($image && null !== ($temp = Photo::find($image)) && is_object($temp))
    $image = $temp;
?>

<section class="b-title _long _invert" style="background-image: url({{ $image->full() }});">

    <div class="b-title__logo _invisible">
        <img src="{{ Config::get('site.theme_path') }}/img/logo/ikra-top.png" alt="ИКРА IKRA">
    </div>

    <div class="b-title__text">
        <h1 class="_mb30">{{ $current_city->name }}</h1>
        <i><strong>{{ $current_city->address }}</strong></i>
    </div>

</section>
开发者ID:Grapheme,项目名称:ikra,代码行数:17,代码来源:contacts__header.blade.php

示例9: testPolymorphicHasManyLoad

 public function testPolymorphicHasManyLoad()
 {
     $photo = Photo::find(1);
     $this->assertEquals(2, $photo->comments->length);
 }
开发者ID:scottdavis,项目名称:nimblize,代码行数:5,代码来源:AssociationsTest.php

示例10: print_r

echo "<br />";
echo $rc->to_xml();
$users = User::find_all();
$user = $users[0];
echo '<pre>';
print_r($users);
var_dump($user);
echo 'photos<br/>';
foreach ($user->photos() as $photo) {
    print_r($photo);
    echo "id<p>";
    echo $photo->id();
    echo "<p> " . $photo->file() . " </p>";
}
echo 'end photos<br/>';
$photos2 = Photo::find(array(1, 2));
var_dump($photos2);
echo "USer start<br/>";
var_dump($photos2[0]->user());
echo "user end<br/>";
$user2 = User::find($user->id());
var_dump($user2);
var_dump($user2->photos());
try {
    $user3 = User::find(4);
    var_dump($user3);
} catch (\ActivePhp\RecordNotFound $e) {
    echo 'execption caught<br/>';
    echo '<br/>';
}
echo "Photo count<br/>";
开发者ID:scottdavis,项目名称:active_php,代码行数:31,代码来源:test.php

示例11: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $photo = Photo::find($id);
     //Delete object from S3 Bucket
     $s3 = AWS::get('s3');
     $s3->deleteObject(array('Bucket' => 'images.jacksonlive.es', 'Key' => "test/high/{$photo->file}"));
     $s3->deleteObject(array('Bucket' => 'images.jacksonlive.es', 'Key' => "test/low/{$photo->file}"));
     $photo->delete();
     return Redirect::route('photo.index');
 }
开发者ID:antonrodin,项目名称:amazon-s3-laravel,代码行数:16,代码来源:PhotoController.php

示例12: array

					<?php 
$id = $resource->id;
$photo_id = $resource->def_photo_id;
if ($photo_id == 0) {
    $photoResId = $resource->photoIds()->first();
    if (empty($photoResId)) {
        $photoUrl = 'img/8.png';
    } else {
        $photoId = $photoResId->photo_id;
        $photoUrl = Photo::find($photoId)->url;
    }
    if (empty($photoUrl)) {
        $photoUrl = 'img/8.png';
    }
} else {
    $photoUrl = Photo::find($photo_id)->url;
}
?>
						<a href="{{ URL::to('resources/' . $resource->id) }}" data-path-hover="m 0,0 0,47.7775 c 24.580441,3.12569 55.897012,-8.199417 90,-8.199417 34.10299,0 65.41956,11.325107 90,8.199417 L 180,0 z">
							<figure>
							
							{{HTML::image($photoUrl, $alt = 'Second image', array('class' => 'img responsive'))}}
								<svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="m 0,0 0,171.14385 c 24.580441,15.47138 55.897012,24.75772 90,24.75772 34.10299,0 65.41956,-9.28634 90,-24.75772 L 180,0 0,0 z"/></svg>
								<figcaption>
									<h2>{{ $resource->name }}</h2>
									<p>{{substr($resource->description,0,50)."....."}}</p>
									
								</figcaption>
							</figure>
						</a>
					@endforeach
开发者ID:shankargiri,项目名称:Quantum-Vic-La-Trobe-L4,代码行数:31,代码来源:res.blade.php

示例13: getImageResize

 /**
  * Ссылка на изображение, подвергнутое кропу или ресайзу
  *
  * URL::route('image.resize', [$photo->id, 200, 200])
  * URL::route('image.resize', [$photo->id, 200, 200, 'r'])
  *
  * См. также /app/config/site.php
  * - galleries_cache_public_dir
  * - galleries_cache_allowed_sizes
  *
  * @param string $method Method of resize - crop or resize
  */
 public function getImageResize($image_id, $w, $h, $method = 'crop')
 {
     $image = $image_id ? Photo::find($image_id) : null;
     #Helper::tad($method);
     /**
      * Костылек-с
      */
     if (is_numeric($method)) {
         $h = $h * 10 + $method;
         #$method = 'crop';
     }
     if ($method == 'r') {
         $method = 'resize';
     } else {
         $method = 'crop';
     }
     #Helper::tad($method);
     /**
      * Соблюдены ли все правила?
      */
     if (!$image_id || !$image || !is_object($image) || !@file_exists($image->fullpath()) || !$w || !$h || $w < 0 || $h < 0 || !in_array($w . 'x' . $h, (array) Config::get('site.galleries_cache_allowed_sizes')) || !in_array($method, ['crop', 'resize'])) {
         App::abort(404);
     }
     /*
     Helper::ta($image_id . '_' . $w . 'x' . $h . $method . '.jpg');
     Helper::ta($image->fullpath());
     Helper::ta($image->fullcachepath($w, $h, $method));
     Helper::ta($image->cachepath($w, $h, $method));
     #Helper::tad($image->full());
     */
     if (!File::exists(Config::get('site.galleries_cache_dir'))) {
         File::makeDirectory(Config::get('site.galleries_cache_dir'), 0777, TRUE);
     }
     $img = ImageManipulation::make($image->fullpath());
     if ($method == 'resize') {
         /**
          * Resize + Resize Canvas
          */
         $img->resize($w, $h, function ($constraint) {
             $constraint->aspectRatio();
             $constraint->upsize();
         });
         $img->resizeCanvas($w, $h);
         /*
                     $newimg = ImageManipulation::canvas($w, $h);
                     $newimg->insert($img, 'center');
                     $img = $newimg;
                     #$newimg->destroy();
                     #*/
     } else {
         /**
          * Resize + Crop
          */
         /**
          * Текущие значения ширины и высоты
          */
         $rw = $img->width();
         $rh = $img->height();
         /**
          * Находим требуемые коэффициенты
          */
         $c1 = $rw / $w;
         ## Делим реальную ширину на желаемую
         $c2 = $rh / $h;
         ## Делим реальную высоту на желаемую
         /**
          * Если c1 < c2 - то ресайзить нужно по ширине
          * Если c1 > c2 - то ресайзить нужно по высоте
          */
         if ($c1 < $c2) {
             /**
              * Ресайзим по меньшей стороне, по ширине
              */
             $nw = $w;
             $nh = null;
         } else {
             /**
              * Ресайзим по меньшей стороне, по высоте
              */
             $nw = null;
             $nh = $h;
         }
         #Helper::tad($nw . 'x' . $nh);
         $img->resize($nw, $nh, function ($constraint) {
             $constraint->aspectRatio();
             $constraint->upsize();
         });
         /**
//.........这里部分代码省略.........
开发者ID:Grapheme,项目名称:amway,代码行数:101,代码来源:galleries.controller.php

示例14: recordImageBy

 public static function recordImageBy($type_name, $type_id)
 {
     try {
         $check = Photo::where('type_name', $type_name)->where('type_id', $type_id)->count();
         if ($check == 1) {
             $getId = Photo::where('type_name', $type_name)->where('type_id', $type_id)->get();
             $update = Photo::find($getId[0]->id);
             $update->name = $name;
             $update->type_name = $type_name;
             $update->type_id = $type_id;
             $update->status = 1;
             $update->save();
         } else {
             $post = new Photo();
             $post->name = $name;
             $post->type_name = $type_name;
             $post->type_id = $type_id;
             $post->status = 1;
             $post->save();
         }
         return "ok";
     } catch (Exception $e) {
         return "no";
     }
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:25,代码来源:Photo.php

示例15: session_start

<?php

require '../config/database.php';
require 'user.php';
require 'photo.php';
// start session
session_start();
require 'helpers.php';
// some helpers require sessions
// must be authorized to view this page
must_be_authorized();
if ($_POST) {
    $photo = Photo::find($_POST['id']);
    $photo->vote();
}
$photos = Photo::random_vs();
?>

<?php 
include 'views/_header.php';
?>

<?php 
include 'views/_navi.php';
?>

<h2>Vote on a Photo</h2>
<?php 
foreach ($photos as $photo) {
    ?>
<div class="versus_photo">
开发者ID:jhsu,项目名称:DMS315,代码行数:31,代码来源:rate.php


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