CakePHP Media Plugin 1.3 Version, UUID File Names

Does anyone else use the David Persons Media Plugin for CakePHP ? I am struggling with customizing some features of the latest version. I would like to configure it to create a UUID-based file name for uploaded images, but I'm not sure how to do this.

I will fight with him a little more, but I am sending a message to find out if anyone here can tell me if 1.3 works at all or does NOT work at all.

+5
source share
1 answer

Finally got a (partial) job. The UUID filename file works when I put the following code in my application model:

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;
}

Media Helper, git (17 2010 .).

+2

All Articles