如果有人正在寻找如何更改FOSOAuthServerBundle的access_token生命周期(expires_in),那么这里是如何做到的:
fos_oauth_server:
service:
user_provider: fos_user.user_manager
options:
access_token_lifetime: 20 #will set token life time to 20 seconds
Run Code Online (Sandbox Code Playgroud)
这样您还可以更改FOSOAuthServerBundle完全使用的OAuth2.0库的其他选项.
希望这篇文章可以节省一些人的时间;)享受其他重要任务和改进的美好时光;)享受
是否可以在不使用doctrine的情况下上传symfony2中的文件?有了教义,这里给出了它的例子:http://symfony.com/doc/2.2/cookbook/doctrine/file_uploads.html
有没有一种上传文件的简单方法,比如在核心PHP中我们有move_uploaded_file()函数,我们可以在提交表单后将上传到文件.
现在,当我在symfony中提交表单时,这就是我在请求数组的'files'部分中获得的内容(Symfony\Component\HttpFoundation\Request)
[files] => Symfony\Component\HttpFoundation\FileBag Object
(
[parameters:protected] => Array
(
[upload_cover] => Symfony\Component\HttpFoundation\File\UploadedFile Object
(
[test:Symfony\Component\HttpFoundation\File\UploadedFile:private] =>
[originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => secret_of_success.png
[mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/png
[size:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 157958
[error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
[pathName:SplFileInfo:private] => C:\xampp\tmp\php3636.tmp
[fileName:SplFileInfo:private] => php3636.tmp
)
)
)
Run Code Online (Sandbox Code Playgroud) 我正在编写一个PHP脚本,可以动态地将上传的视频文件转换为FLV,但是如果用户在服务器上安装了FFmpeg,我只希望它能够运行该部分脚本.
有没有办法提前发现这个?我是否可以运行FFmpeg命令并测试它是否返回"命令未找到?"
我正在使用youtube data api v3来上传图像和音频,因为带有图像的视频将显示为视频.
我可以上传视频作为示例.
我试图thumbnail: $('#file_image').val(),设置视频缩略图.但它并没有像我预期的那样奏效.我也在互联网上搜索以获得一个想法.但是没有任何想法.
UploadVideo.prototype.uploadFile = function(file) {
var metadata = {
snippet: {
title: $('#title').val(),
description: $('#description').text(),
tags: this.tags,
thumbnail: $('#file_image').val(),
categoryId: this.categoryId
},
Run Code Online (Sandbox Code Playgroud)
使用youtube数据api可以实现此功能吗?我知道我们可以将图像和音频一起上传到youtube中作为视频(而不是通过API).
更新:
使用ffmpeg,我们可以通过组合音频和图像来创建视频.创建的视频通过Youtube DATA API上传到Youtube.有用.现在我尝试使用脚本自动执行以下场景.
上传图片和音频.使用ffmpeg创建视频.视频成功创建后,使用Youtube DATA API上传视频.
我可以在命令行中使用ffmpeg命令创建视频.但是当我尝试使用PHP代码时,命令没有执行.
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
Run Code Online (Sandbox Code Playgroud)
我想将我的symfony2.0项目升级到symfony 2.3.
https://github.com/symfony/symfony-standard/blob/v2.3.1/UPGRADE.md
我按照上面的一个来升级我的项目.但是我面临以下错误
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
Run Code Online (Sandbox Code Playgroud) 我正在尝试访问Symfony控制器中的服务
$session = $this->get('session');
Run Code Online (Sandbox Code Playgroud)
但我得到了下一个错误:
PHP Fatal error: Call to a member function get() on a non-object
Run Code Online (Sandbox Code Playgroud)
我认为Symfony2默认将控制器定义为服务.
注意:这个问题最初是由Dbugger提出的,但他已经无缘无故地删除了它,而它已经得到了解答.
我正在尝试根据存储在数据库中的当前用户的首选项设置区域设置.
因此,我们的User类有一个getPreferredLanguage,它返回一个语言环境标识('en','fr_FR'等).
我考虑过以下方法:
不幸的是,这不起作用.当调用"locale"侦听器服务的onRequestEvent方法时,安全上下文没有令牌.看起来上下文监听器是在一个非常晚的阶段(优先级为0)调用的,并且不可能告诉我的"locale"监听器在安全上下文之前运行.
有谁知道如何修复这种方法,或建议另一种方法?
我有一个视频托管网站,并已在我的本地服务器上成功安装了ffmpeg.事情总体上起作用,但我无法获得视频时长,也不知道如何将视频转换为ogg格式.我可以将视频转换为mp4但不确定相同的代码是否也可以转换为ogg.
还有一件事是我可以在视频开头从视频中获取缩略图,但我想在50秒后获得它.
$base = basename($uploadfile, $safe_file['ext']);
$new_file = $base.'mp4';
$new_image = $base.'jpg';
$new_image_path = $live_img.$new_image;
$new_flv = $live_dir.$new_file;
equire 'vendor/autoload.php';
//ececute ffmpeg generate mp4
exec('ffmpeg -i '.$uploadfile.' -f mp4 -s 896x504 '.$new_flv.'');
//execute ffmpeg and create thumb
exec('ffmpeg -i '.$uploadfile.' -f mjpeg -vframes 71 -s 768x432 -an '.$new_image_path.'');
Run Code Online (Sandbox Code Playgroud) 我正在开发一个视频流媒体网站,用户可以将视频上传到网站(使用uploadify jquery插件一次播放多个视频).
现在,我面临的问题是将视频编码为FLV以便在线流式传输.
应该何时进行视频编码过程?它应该在上传完成后立即发生(即重定向用户上传成功页面,然后使用exec命令在后台开始编码ffmpeg?)但是,使用这种方法,我如何确定编码是否成功完成?如果用户上传损坏的视频并且ffmpeg无法编码,该怎么办?我如何在PHP中处理这个?
如何排队视频编码,因为多个用户可以同时上传视频?FFMpeg有自己的编码队列吗?
我还在另一个相关的SO线程中阅读了有关gearman和消息队列选项的信息,例如redis和AMQP.这些是潜在的解决方案吗?
如果有人能回答我的问题,我将非常感激.
我正在尝试将一些用户加载到我的数据库中,以便使用DoctrineFixturesBundle进行测试.我在StackOverflow上做了很多搜索,并且发现了很多其他问题.似乎没有我的答案.我正在加载我的用户使用FOS用户管理器.下面是我的夹具课程.
namespace Kandidly\UserBundle\DataFixtures;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class LoadUserData extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
{
private $container;
/**
* {@inheritDoc}
*/
public function load(ObjectManager $manager)
{
$userManager = $this->container->get('fos_user.user_manager');
$user1 = $userManager->createUser();
$user1->setFirstName('Admin');
$user1->setLastName('User');
$user1->setCity('Somewhere');
$user1->setState('TN');
$user1->setUsername('admin');
$user1->setEmail('admin@example.com');
$user1->setPlainPassword('admin');
$user1->setEnabled(true);
$user1->setRoles(
array(
'ROLE_ADMIN'
)
);
$user2 = $userManager->createUser();
$user2->setFirstName('Normal');
$user2->setLastName('User');
$user2->setCity('Another');
$user2->setState('CA');
$user2->setUsername('user');
$user2->setEmail('use@example.com');
$user2->setPlainPassword('user');
$user2->setEnabled(true);
$user2->setRoles(
array(
'ROLE_USER'
)
);
$userManager->updateUser($user1);
$userManager->updateUser($user2);
$this->addReference('admin-user', $user1);
}
/**
* Get the order of this fixture …Run Code Online (Sandbox Code Playgroud) php ×6
symfony ×6
ffmpeg ×3
video ×2
access-token ×1
command ×1
file-upload ×1
fixtures ×1
locale ×1
oauth ×1
symfony-2.2 ×1
version ×1
youtube ×1