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


PHP Photo::add方法代码示例

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


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

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

示例2: photo

 static function photo($database, $plugins, $settings, $path, $albumID = 0, $description = '', $tags = '')
 {
     # No need to validate photo type and extension in this function.
     # $photo->add will take care of it.
     $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:thejandroman,项目名称:Lychee,代码行数:18,代码来源:Import.php

示例3: photo

 /**
  * Creates an array similar to a file upload array and adds the photo to Lychee.
  * @return boolean Returns true when photo import was successful.
  */
 private function photo($path, $albumID = 0)
 {
     // No need to validate photo type and extension in this function.
     // $photo->add will take care of it.
     $info = getimagesize($path);
     $size = filesize($path);
     $photo = new Photo(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;
     $nameFile[0]['error'] = UPLOAD_ERR_OK;
     if ($photo->add($nameFile, $albumID, true) === false) {
         return false;
     }
     return true;
 }
开发者ID:windhamdavid,项目名称:Lychee,代码行数:23,代码来源:Import.php

示例4: photo

 private function photo($path, $albumID = 0, $description = '', $tags = '')
 {
     # Check dependencies
     self::dependencies(isset($this->database, $this->plugins, $this->settings, $path));
     # No need to validate photo type and extension in this function.
     # $photo->add will take care of it.
     $info = getimagesize($path);
     $size = filesize($path);
     $photo = new Photo($this->database, $this->plugins, $this->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;
     $nameFile[0]['error'] = UPLOAD_ERR_OK;
     if (!$photo->add($nameFile, $albumID, $description, $tags, true)) {
         return false;
     }
     return true;
 }
开发者ID:gautamkrishnar,项目名称:Lychee,代码行数:21,代码来源:Import.php

示例5: upload

 private function upload()
 {
     Module::dependencies(isset($_FILES, $_POST['albumID'], $_POST['tags']));
     $photo = new Photo($this->database, $this->plugins, $this->settings, null);
     echo $photo->add($_FILES, $_POST['albumID'], '', $_POST['tags']);
 }
开发者ID:fredrikcarno,项目名称:Lychee,代码行数:6,代码来源:Admin.php

示例6: store

 /**
  * undocumented function
  *
  * @return void
  * @author 
  **/
 public function store()
 {
     $lokasi = public_path() . '/photos/';
     $validator = $this->storeValid();
     if ($validator->passes()) {
         $input = $this->storeInput();
         $photo = Photo::add($input);
         $file = $_FILES['photo']['tmp_name'];
         // Extension
         $ext = pathinfo($_FILES["photo"]["name"], PATHINFO_EXTENSION);
         if ($photo && move_uploaded_file($_FILES['photo']['tmp_name'], $lokasi . $photo->id . '.' . $ext)) {
             $img = Image::make($lokasi . $photo->id . '.' . $ext);
             if ($ext != 'jpg') {
                 $img->encode('jpg', 75);
                 $img->save($lokasi . $photo->id . '.jpg');
             }
             $img->fit(200);
             $img->save($lokasi . 'thumb_' . $photo->id . '.jpg');
             // Menghapus file lama setelah kita meng-convert-nya ke jpg
             if ($ext != 'jpg') {
                 unlink($lokasi . $photo->id . '.' . $ext);
             }
             return Redirect::route('admin.photo')->withStatuses(['add' => 'Tambah Berhasil!']);
         }
         return Redirect::route('admin.photo.create')->withErrors(['add' => 'Tambah Gagal!'])->withInput();
     }
     return Redirect::route('admin.photo.create')->withErrors($validator)->withInput();
 }
开发者ID:whiterun,项目名称:bagikasih-v2,代码行数:34,代码来源:AdminPhotoController.php


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