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


PHP Media::all方法代码示例

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


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

示例1: dashboard

 public function dashboard()
 {
     $settings = Setting::first();
     $media = Media::all();
     $users = User::all();
     $comments = Comment::all();
     $categories = Category::all();
     $data = array('settings' => $settings, 'media' => $media, 'users' => $users, 'comments' => $comments, 'categories' => $categories);
     return View::make('admin.sections.dashboard', $data);
 }
开发者ID:phanhung0906,项目名称:demo1,代码行数:10,代码来源:AdminController.php

示例2: array

<?php

return array('GET /admin, GET /admin/pages' => array('before' => 'auth', function () {
    $pages = Page::all();
    $view = View::of_admin_layout();
    $view->content = View::make('admin.pages')->with('pages', $pages);
    return $view;
}), 'GET /admin/media' => array('before' => 'auth', function () {
    $files = Media::all();
    $view = View::of_admin_layout();
    $view->content = View::make('admin.media')->with('files', $files);
    return $view;
}), 'GET /admin/users' => array('before' => 'auth', function () {
    $users = User::all();
    $view = View::of_admin_layout();
    $view->content = View::make('admin.users')->with('users', $users);
    return $view;
}), 'GET /admin/newpage/(:num?)' => array('before' => 'auth', function ($pageid = NULL) {
    if ($pageid) {
        $page = Page::find($pageid);
    }
    $view = View::of_admin_layout();
    $view->content = View::make('admin.newpage')->with('page', $page);
    return $view;
}), 'GET /admin/newmedia' => array('before' => 'auth', function () {
    $view = View::of_admin_layout();
    $view->content = View::make('admin.newmedia');
    return $view;
}), 'GET /admin/newuser' => array('before' => 'auth', function () {
    $roleoptions = array('admin' => 'Admin', 'edit' => 'Editor');
    $view = View::of_admin_layout();
开发者ID:rebelnz,项目名称:rebelcms,代码行数:31,代码来源:admin.php

示例3: getMediaLibrary

 /**
  * Displays the library view.
  */
 public function getMediaLibrary()
 {
     // Get all the media.
     $media = Media::all();
     // Render the view.
     return View::make('admin.media.library', ['media' => $media]);
 }
开发者ID:Fash1,项目名称:Fash1,代码行数:10,代码来源:AdminController.php

示例4: getMedia

 public function getMedia()
 {
     $media = Media::all();
     return Response::json($media);
 }
开发者ID:nvq247,项目名称:Kxexnxh,代码行数:5,代码来源:ApiController.php

示例5: upload

 public static function upload($args)
 {
     $image = $args['image'];
     $folder = $args['folder'];
     $filename = $args['filename'];
     $type = $args['type'];
     if ($folder == 'images') {
         $month_year = date('FY') . '/';
     } else {
         $month_year = '';
     }
     $upload_folder = Constant::FOLDER_CLOUDINARY . '/' . $month_year;
     $arrayAllMedia = Media::all();
     if (@getimagesize($image)) {
         if ($type == 'upload') {
             $filename = str_replace(" ", "-", $image->getClientOriginalName());
             // if the file exists give it a unique name
             foreach ($arrayAllMedia as $media) {
                 if ($month_year . $filename == $media->pic_url) {
                     $filename = uniqid() . '-' . $filename;
                 }
             }
             // Store in cloudinary
             \Cloudinary\Uploader::upload($_FILES['pic_url']['tmp_name'], array("public_id" => $upload_folder . '/' . pathinfo($filename, PATHINFO_FILENAME)));
             //				$uploadSuccess = $image->move($upload_folder, $filename);
             if (strpos($filename, '.gif') > 0) {
                 $new_filename = str_replace('.gif', '-animation.gif', $filename);
                 //					copy($upload_folder . $filename, $upload_folder . $new_filename);
                 \Cloudinary\Uploader::upload($_FILES['pic_url']['tmp_name'], array("public_id" => $upload_folder . '/' . pathinfo($new_filename, PATHINFO_FILENAME)));
             }
         } elseif ($type = 'url') {
             //                $file = file_get_contents($image);
             if (strpos($image, '.gif') > 0) {
                 $extension = '-animation.gif';
             } else {
                 $extension = '.jpg';
             }
             $filename = str_replace(" ", "-", $filename . $extension);
             // if the file exists give it a unique name
             foreach ($arrayAllMedia as $media) {
                 if ($month_year . $filename == $media->pic_url) {
                     $filename = uniqid() . '-' . $filename . $extension;
                 }
             }
             if (strpos($image, '.gif') > 0) {
                 // Store in cloudinary
                 \Cloudinary\Uploader::upload($image, array("public_id" => $upload_folder . '/' . pathinfo($filename, PATHINFO_FILENAME)));
                 $filename = str_replace('-animation.gif', '.gif', $filename);
             }
             \Cloudinary\Uploader::upload($image, array("public_id" => $upload_folder . '/' . pathinfo($filename, PATHINFO_FILENAME)));
         }
         $settings = Setting::first();
         if ($settings->enable_watermark && $folder == 'images') {
             // Setting watermark + resize
             cl_image_tag($upload_folder . '/' . $filename, array("overlay" => Config::get('site.uploads_dir') . '/settings/' . $settings->watermark_image, "x" => $settings->watermark_offset_x, "y" => $settings->watermark_offset_y));
         } else {
             // Setting watermark + resize
             cl_image_tag($upload_folder . '/' . $filename, array("width" => 200, "height" => 200));
         }
         return $month_year . $filename;
     } else {
         return false;
     }
 }
开发者ID:phanhung0906,项目名称:demo1,代码行数:64,代码来源:ImageHandler.php


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