Skip to content

Commit

Permalink
New feature : configuration option for thumbnail directory
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@3720 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
nikrou committed Aug 2, 2009
1 parent d8144df commit 513b3e0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion admin/thumbnail.php
Expand Up @@ -204,7 +204,7 @@ function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext)
// searching the element
$filename_wo_ext = get_filename_wo_extension($filename);
$tn_ext = '';
$base_test = $dirname.'/thumbnail/';
$base_test = $dirname.'/'.$conf['dir_thumbnail'].'/';
$base_test.= $conf['prefix_thumbnail'].$filename_wo_ext.'.';
foreach ($conf['picture_ext'] as $ext)
{
Expand Down
2 changes: 1 addition & 1 deletion admin/upload.php
Expand Up @@ -187,7 +187,7 @@
$thumbnail.= get_filename_wo_extension( $row['file'] );
$thumbnail.= '.'.$row['tn_ext'];
$url = $cat_names[$row['storage_category_id']]['dir'];
$url.= 'thumbnail/'.$thumbnail;
$url.= $conf['dir_thumbnail'].'/'.$thumbnail;

$tpl_var['thumbnail'] =
array(
Expand Down
3 changes: 3 additions & 0 deletions include/config_default.inc.php
Expand Up @@ -264,6 +264,9 @@
// contain characters among : a to z (case insensitive), "-" or "_".
$conf['prefix_thumbnail'] = 'TN-';

// dir_thumbnail : directory where thumbnail reside.
$conf['dir_thumbnail'] = 'thumbnail';

// users_page: how many users to display in screen
// Administration>Identification>Users?
$conf['users_page'] = 20;
Expand Down
4 changes: 2 additions & 2 deletions include/functions.inc.php
Expand Up @@ -256,7 +256,7 @@ function mkgetdir($dir, $flags=MKGETDIR_DEFAULT)
*/
function mkget_thumbnail_dir($dirname, &$errors)
{
$tndir = $dirname.'/thumbnail';
$tndir = $dirname.'/'.$conf['dir_thumbnail'];
if (! mkgetdir($tndir, MKGETDIR_NONE) )
{
array_push($errors,
Expand Down Expand Up @@ -865,7 +865,7 @@ function get_thumbnail_location($element_info)
{
$path = substr_replace(
get_filename_wo_extension($element_info['path']),
'/thumbnail/'.$conf['prefix_thumbnail'],
'/'.$conf['dir_thumbnail'].'/'.$conf['prefix_thumbnail'],
strrpos($element_info['path'],'/'),
1
);
Expand Down
2 changes: 1 addition & 1 deletion include/ws_functions.inc.php
Expand Up @@ -1065,7 +1065,7 @@ function ws_images_add($params, &$service)

// thumbnail directory is a subdirectory of the photo file, hard coded
// "thumbnail"
$thumbnail_dir = $upload_dir.'/thumbnail';
$thumbnail_dir = $upload_dir.'/'.$conf['dir_thumbnail'];
if (!is_dir($thumbnail_dir)) {
umask(0000);
if (!@mkdir($thumbnail_dir, 0777))
Expand Down

0 comments on commit 513b3e0

Please sign in to comment.