Ability to customize filenames, replacing the standard UNIX timestamp + random
This commit is contained in:
parent
f25365dec5
commit
0279cfd3fb
@ -326,7 +326,7 @@
|
|||||||
* Image settings
|
* Image settings
|
||||||
* ====================
|
* ====================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// For resizing, max values
|
// For resizing, max values
|
||||||
$config['thumb_width'] = 255;
|
$config['thumb_width'] = 255;
|
||||||
$config['thumb_height'] = 255;
|
$config['thumb_height'] = 255;
|
||||||
@ -353,6 +353,10 @@
|
|||||||
// $config['allowed_ext_files'][] = 'txt';
|
// $config['allowed_ext_files'][] = 'txt';
|
||||||
// $config['allowed_ext_files'][] = 'zip';
|
// $config['allowed_ext_files'][] = 'zip';
|
||||||
|
|
||||||
|
// An alternative function for generating a filename, instead of the default UNIX timestamp with appended random digits
|
||||||
|
// http://tinyboard.org/wiki/index.php?title=Filenames
|
||||||
|
// $config['filename_func'] = 'some_function_you_have_created';
|
||||||
|
|
||||||
// Non-image file icons
|
// Non-image file icons
|
||||||
$config['file_icons']['default'] = 'file.png';
|
$config['file_icons']['default'] = 'file.png';
|
||||||
$config['file_icons']['zip'] = 'zip.png';
|
$config['file_icons']['zip'] = 'zip.png';
|
||||||
|
5
post.php
5
post.php
@ -311,7 +311,10 @@
|
|||||||
|
|
||||||
if($post['has_file']) {
|
if($post['has_file']) {
|
||||||
$post['extension'] = strtolower(substr($post['filename'], strrpos($post['filename'], '.') + 1));
|
$post['extension'] = strtolower(substr($post['filename'], strrpos($post['filename'], '.') + 1));
|
||||||
$post['file_id'] = time() . rand(100, 999);
|
if(isset($config['filename_func']))
|
||||||
|
$post['file_id'] = $config['filename_func']($post);
|
||||||
|
else
|
||||||
|
$post['file_id'] = time() . rand(100, 999);
|
||||||
$post['file'] = $board['dir'] . $config['dir']['img'] . $post['file_id'] . '.' . $post['extension'];
|
$post['file'] = $board['dir'] . $config['dir']['img'] . $post['file_id'] . '.' . $post['extension'];
|
||||||
$post['thumb'] = $board['dir'] . $config['dir']['thumb'] . $post['file_id'] . '.' . ($config['thumb_ext'] ? $config['thumb_ext'] : $post['extension']);
|
$post['thumb'] = $board['dir'] . $config['dir']['thumb'] . $post['file_id'] . '.' . ($config['thumb_ext'] ? $config['thumb_ext'] : $post['extension']);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user