本文整理汇总了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);
}
示例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();
示例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]);
}
示例4: getMedia
public function getMedia()
{
$media = Media::all();
return Response::json($media);
}
示例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;
}
}