the*_*her 5 cakephp cakephp-1.3
还有其他人使用David Persson的CakePHP媒体插件吗?我正在努力设置最新版本的一些功能.我想设置它为上传的图像制作一个基于UUID的文件名,但我不知道如何去做.
我会更多地与它斗争,但我发帖是为了找出这里是否有人可以告诉我1.3是否正常工作或一般不工作.
终于让这个(部分)工作了。当我将以下代码放入我的附件模型中时,UUID 文件名内容将起作用:
function transferTo($via, $from) {
extract($from);
$irregular = array(
'image' => 'img',
'text' => 'txt'
);
$name = Mime_Type::guessName($mimeType ? $mimeType : $file);
if (isset($irregular[$name])) {
$short = $irregular[$name];
} else {
$short = substr($name, 0, 3);
}
$path = $short . DS;
$path .= String::uuid();
$path .= !empty($extension) ? '.' . strtolower($extension) : null;
return $path;
}
Run Code Online (Sandbox Code Playgroud)
我在媒体助手的其他部分仍然遇到一些问题,但作者今天(2010 年 7 月 17 日)在他的 git 存储库中发布了一些更新。