mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
- images.path column added to reduce database access
- function mass_inserts moved from admin/remote_sites.php to admin/include/function.php - function mass_inserts used in admin/update.php git-svn-id: http://piwigo.org/svn/trunk@606 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -784,4 +784,51 @@ function my_error($header, $echo = true)
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* inserts multiple lines in a table
|
||||
*
|
||||
* @param string table_name
|
||||
* @param array dbields
|
||||
* @param array inserts
|
||||
* @return void
|
||||
*/
|
||||
function mass_inserts($table_name, $dbfields, $inserts)
|
||||
{
|
||||
// inserts all found categories
|
||||
$query = '
|
||||
INSERT INTO '.$table_name.'
|
||||
('.implode(',', $dbfields).')
|
||||
VALUES';
|
||||
foreach ($inserts as $insert_id => $insert)
|
||||
{
|
||||
$query.= '
|
||||
';
|
||||
if ($insert_id > 0)
|
||||
{
|
||||
$query.= ',';
|
||||
}
|
||||
$query.= '(';
|
||||
foreach ($dbfields as $field_id => $dbfield)
|
||||
{
|
||||
if ($field_id > 0)
|
||||
{
|
||||
$query.= ',';
|
||||
}
|
||||
|
||||
if (!isset($insert[$dbfield]) or $insert[$dbfield] == '')
|
||||
{
|
||||
$query.= 'NULL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query.= "'".$insert[$dbfield]."'";
|
||||
}
|
||||
}
|
||||
$query.=')';
|
||||
}
|
||||
$query.= '
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -319,9 +319,7 @@ SELECT *
|
||||
$result = pwg_query($query);
|
||||
while ($row = mysql_fetch_array($result))
|
||||
{
|
||||
$thumbnail_url = get_thumbnail_src($row['file'],
|
||||
$row['storage_category_id'],
|
||||
@$row['tn_ext']);
|
||||
$thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
||||
|
||||
$template->assign_block_vars(
|
||||
'picture',
|
||||
|
||||
@@ -199,9 +199,7 @@ else
|
||||
$current_category = get_cat_info($row['storage_category_id']);
|
||||
$dir_path = get_cat_display_name($current_category['name'], '->', '');
|
||||
|
||||
$thumbnail_url = get_thumbnail_src($row['file'],
|
||||
$row['storage_category_id'],
|
||||
@$row['tn_ext']);
|
||||
$thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
||||
|
||||
$url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id'];
|
||||
$url_img .= '&cat='.$row['storage_category_id'];
|
||||
|
||||
@@ -111,53 +111,6 @@ SELECT id,dir
|
||||
return $database_dirs;
|
||||
}
|
||||
|
||||
/**
|
||||
* inserts multiple lines in a table
|
||||
*
|
||||
* @param string table_name
|
||||
* @param array dbields
|
||||
* @param array inserts
|
||||
* @return void
|
||||
*/
|
||||
function mass_inserts($table_name, $dbfields, $inserts)
|
||||
{
|
||||
// inserts all found categories
|
||||
$query = '
|
||||
INSERT INTO '.$table_name.'
|
||||
('.implode(',', $dbfields).')
|
||||
VALUES';
|
||||
foreach ($inserts as $insert_id => $insert)
|
||||
{
|
||||
$query.= '
|
||||
';
|
||||
if ($insert_id > 0)
|
||||
{
|
||||
$query.= ',';
|
||||
}
|
||||
$query.= '(';
|
||||
foreach ($dbfields as $field_id => $dbfield)
|
||||
{
|
||||
if ($field_id > 0)
|
||||
{
|
||||
$query.= ',';
|
||||
}
|
||||
|
||||
if (!isset($insert[$dbfield]) or $insert[$dbfield] == '')
|
||||
{
|
||||
$query.= 'NULL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query.= "'".$insert[$dbfield]."'";
|
||||
}
|
||||
}
|
||||
$query.=')';
|
||||
}
|
||||
$query.= '
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* read $listing_file and update a remote site according to its id
|
||||
*
|
||||
@@ -418,7 +371,8 @@ SELECT file
|
||||
'author',
|
||||
'keywords',
|
||||
'name',
|
||||
'comment');
|
||||
'comment',
|
||||
'path');
|
||||
foreach ($optional_atts as $att)
|
||||
{
|
||||
if (getAttribute($xml_element, $att) != '')
|
||||
@@ -434,7 +388,7 @@ SELECT file
|
||||
{
|
||||
$dbfields = array('file','storage_category_id','date_available','tn_ext',
|
||||
'filesize','width','height','date_creation','author',
|
||||
'keywords','name','comment');
|
||||
'keywords','name','comment','path');
|
||||
mass_inserts(IMAGES_TABLE, $dbfields, $inserts);
|
||||
$counts{'new_elements'}+= count($inserts);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ if( !defined("PHPWG_ROOT_PATH") )
|
||||
}
|
||||
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
|
||||
|
||||
define('CURRENT_DATE', "'".date('Y-m-d')."'");
|
||||
define('CURRENT_DATE', date('Y-m-d'));
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | functions |
|
||||
// +-----------------------------------------------------------------------+
|
||||
@@ -407,10 +407,11 @@ SELECT file
|
||||
if ($tn_ext != '')
|
||||
{
|
||||
$insert = array();
|
||||
$insert['file'] = "'".$unregistered_element."'";
|
||||
$insert['file'] = $unregistered_element;
|
||||
$insert['storage_category_id'] = $category_id;
|
||||
$insert['date_available'] = CURRENT_DATE;
|
||||
$insert['tn_ext'] = "'".$tn_ext."'";
|
||||
$insert['tn_ext'] = $tn_ext;
|
||||
$insert['path'] = $dir.$unregistered_element;
|
||||
|
||||
$counts['new_elements']++;
|
||||
array_push($inserts, $insert);
|
||||
@@ -446,16 +447,17 @@ SELECT file
|
||||
}
|
||||
|
||||
$insert = array();
|
||||
$insert['file'] = "'".$unregistered_element."'";
|
||||
$insert['file'] = $unregistered_element;
|
||||
$insert['path'] = $dir.$unregistered_element;
|
||||
$insert['storage_category_id'] = $category_id;
|
||||
$insert['date_available'] = CURRENT_DATE;
|
||||
if ( $tn_ext != '' )
|
||||
{
|
||||
$insert['tn_ext'] = "'".$tn_ext."'";
|
||||
$insert['tn_ext'] = $tn_ext;
|
||||
}
|
||||
if ( $representative_ext != '' )
|
||||
{
|
||||
$insert['representative_ext'] = "'".$representative_ext."'";
|
||||
$insert['representative_ext'] = $representative_ext;
|
||||
}
|
||||
|
||||
$counts['new_elements']++;
|
||||
@@ -475,44 +477,9 @@ SELECT file
|
||||
// inserts all found pictures
|
||||
$dbfields = array(
|
||||
'file','storage_category_id','date_available','tn_ext'
|
||||
,'representative_ext'
|
||||
,'representative_ext','path'
|
||||
);
|
||||
$query = '
|
||||
INSERT INTO '.IMAGES_TABLE.'
|
||||
('.implode(',', $dbfields).')
|
||||
VALUES
|
||||
';
|
||||
foreach ($inserts as $insert_id => $insert)
|
||||
{
|
||||
$query.= '
|
||||
';
|
||||
if ($insert_id > 0)
|
||||
{
|
||||
$query.= ',';
|
||||
}
|
||||
$query.= '(';
|
||||
foreach ($dbfields as $field_id => $dbfield)
|
||||
{
|
||||
if ($field_id > 0)
|
||||
{
|
||||
$query.= ',';
|
||||
}
|
||||
|
||||
if (!isset($insert[$dbfield]) or $insert[$dbfield] == '')
|
||||
{
|
||||
$query.= 'NULL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query.= $insert[$dbfield];
|
||||
}
|
||||
}
|
||||
$query.=')';
|
||||
}
|
||||
$query.= '
|
||||
;';
|
||||
|
||||
pwg_query($query);
|
||||
mass_inserts(IMAGES_TABLE, $dbfields, $inserts);
|
||||
|
||||
// what are the ids of the pictures in the $category_id ?
|
||||
$ids = array();
|
||||
|
||||
@@ -140,7 +140,7 @@ while ($row = mysql_fetch_array($result))
|
||||
// for each picture, getting informations for displaying thumbnail and
|
||||
// link to the full size picture
|
||||
$query = '
|
||||
SELECT name,file,storage_category_id as cat_id,tn_ext
|
||||
SELECT name,file,storage_category_id as cat_id,tn_ext,path
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE id = '.$row['image_id'].'
|
||||
;';
|
||||
@@ -166,9 +166,7 @@ SELECT name,file,storage_category_id as cat_id,tn_ext
|
||||
}
|
||||
$name.= ' [ '.$subrow['file'].' ]';
|
||||
// source of the thumbnail picture
|
||||
$thumbnail_src = get_thumbnail_src($subrow['file'],
|
||||
$subrow['cat_id'],
|
||||
@$subrow['tn_ext']);
|
||||
$thumbnail_src = get_thumbnail_src($subrow['path'], @$subrow['tn_ext']);
|
||||
// link to the full size picture
|
||||
$url = PHPWG_ROOT_PATH.'picture.php?cat='.$category_id;
|
||||
$url.= '&image_id='.$row['image_id'];
|
||||
|
||||
@@ -219,7 +219,7 @@ if (!isset($page['calendar_year']))
|
||||
foreach ($calendar_years as $calendar_year => $nb_pics)
|
||||
{
|
||||
$query = '
|
||||
SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
|
||||
SELECT file,tn_ext,'.$conf['calendar_datefield'].',path
|
||||
FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
|
||||
'.$page['where'].'
|
||||
AND YEAR('.$conf['calendar_datefield'].') = '.$calendar_year.'
|
||||
@@ -229,9 +229,7 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
|
||||
;';
|
||||
$row = mysql_fetch_array(pwg_query($query));
|
||||
|
||||
$thumbnail_src = get_thumbnail_src($row['file'],
|
||||
$row['storage_category_id'],
|
||||
@$row['tn_ext']);
|
||||
$thumbnail_src = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
||||
|
||||
$name = $calendar_year.' ('.$nb_pics.')';
|
||||
|
||||
@@ -266,7 +264,7 @@ elseif (!isset($page['calendar_month']))
|
||||
foreach ($calendar_months as $calendar_month => $nb_pics)
|
||||
{
|
||||
$query = '
|
||||
SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
|
||||
SELECT file,tn_ext,'.$conf['calendar_datefield'].',path
|
||||
FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
|
||||
'.$page['where'].'
|
||||
AND YEAR('.$conf['calendar_datefield'].') = '.$page['calendar_year'].'
|
||||
@@ -277,9 +275,7 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
|
||||
;';
|
||||
$row = mysql_fetch_array(pwg_query($query));
|
||||
|
||||
$thumbnail_src = get_thumbnail_src($row['file'],
|
||||
$row['storage_category_id'],
|
||||
@$row['tn_ext']);
|
||||
$thumbnail_src = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
||||
|
||||
$name = $lang['month'][$calendar_month];
|
||||
$name.= ' '.$page['calendar_year'];
|
||||
@@ -322,7 +318,7 @@ elseif (!isset($page['calendar_day']))
|
||||
foreach ($calendar_days as $calendar_day => $nb_pics)
|
||||
{
|
||||
$query = '
|
||||
SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
|
||||
SELECT file,tn_ext,'.$conf['calendar_datefield'].',path
|
||||
FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
|
||||
'.$page['where'].'
|
||||
AND '.$conf['calendar_datefield'].' = \''.$calendar_day.'\'
|
||||
@@ -332,9 +328,7 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
|
||||
;';
|
||||
$row = mysql_fetch_array(pwg_query($query));
|
||||
|
||||
$thumbnail_src = get_thumbnail_src($row['file'],
|
||||
$row['storage_category_id'],
|
||||
@$row['tn_ext']);
|
||||
$thumbnail_src = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
||||
|
||||
list($year,$month,$day) = explode('-', $calendar_day);
|
||||
$unixdate = mktime(0,0,0,$month,$day,$year);
|
||||
@@ -385,7 +379,7 @@ elseif (isset($page['calendar_day']))
|
||||
$name.= ' ('.$nb_pics.')';
|
||||
|
||||
$query = '
|
||||
SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
|
||||
SELECT file,tn_ext,'.$conf['calendar_datefield'].',path
|
||||
FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
|
||||
'.$page['where'].'
|
||||
AND '.$conf['calendar_datefield'].' = \''.$page['calendar_date'].'\'';
|
||||
@@ -401,9 +395,7 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
|
||||
;';
|
||||
$row = mysql_fetch_array(pwg_query($query));
|
||||
|
||||
$thumbnail_src = get_thumbnail_src($row['file'],
|
||||
$row['storage_category_id'],
|
||||
@$row['tn_ext']);
|
||||
$thumbnail_src = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
||||
|
||||
$thumbnail_title = $lang['calendar_picture_hint'].$name;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
$array_cat_directories = array();
|
||||
|
||||
$query = '
|
||||
SELECT DISTINCT(id),file,date_available,category_id
|
||||
SELECT DISTINCT(id),path,file,date_available,category_id
|
||||
,tn_ext,name,filesize,storage_category_id,average_rate
|
||||
FROM '.IMAGES_TABLE.' AS i
|
||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=ic.image_id
|
||||
@@ -80,9 +80,7 @@ while ($row = mysql_fetch_array($result))
|
||||
$name = replace_search($name, $_GET['search']);
|
||||
}
|
||||
|
||||
$thumbnail_url = get_thumbnail_src($row['file'],
|
||||
$row['storage_category_id'],
|
||||
@$row['tn_ext']);
|
||||
$thumbnail_url = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
||||
|
||||
// message in title for the thumbnail
|
||||
$thumbnail_title = $row['file'];
|
||||
|
||||
@@ -66,7 +66,7 @@ while ( $row = mysql_fetch_array( $result ) )
|
||||
$name = get_cat_display_name($cat_infos['name'],'<br />','',false);
|
||||
|
||||
$query = '
|
||||
SELECT id,file,tn_ext,storage_category_id
|
||||
SELECT path,file,tn_ext
|
||||
FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
|
||||
WHERE category_id = '.$row['category_id'].'
|
||||
AND date_available > SUBDATE(CURRENT_DATE
|
||||
@@ -75,11 +75,9 @@ SELECT id,file,tn_ext,storage_category_id
|
||||
ORDER BY RAND()
|
||||
LIMIT 0,1
|
||||
;';
|
||||
$subrow = mysql_fetch_array( pwg_query( $query ) );
|
||||
$subrow = mysql_fetch_array(pwg_query($query));
|
||||
|
||||
$thumbnail_src = get_thumbnail_src($subrow['file'],
|
||||
$subrow['storage_category_id'],
|
||||
@$subrow['tn_ext']);
|
||||
$thumbnail_src = get_thumbnail_src($subrow['path'], @$subrow['tn_ext']);
|
||||
|
||||
$url_link = PHPWG_ROOT_PATH.'category.php?cat='.$row['category_id'];
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ SELECT representative_picture_id
|
||||
$row = mysql_fetch_array(pwg_query($query));
|
||||
|
||||
$query = '
|
||||
SELECT file,tn_ext,storage_category_id
|
||||
SELECT file,path,tn_ext
|
||||
FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
|
||||
WHERE category_id = '.$non_empty_id.'
|
||||
AND id = image_id';
|
||||
@@ -86,8 +86,7 @@ SELECT file,tn_ext,storage_category_id
|
||||
$image_result = pwg_query($query);
|
||||
$image_row = mysql_fetch_array($image_result);
|
||||
|
||||
$thumbnail_link = get_thumbnail_src($image_row['file'],
|
||||
$image_row['storage_category_id'],
|
||||
$thumbnail_link = get_thumbnail_src($image_row['path'],
|
||||
@$image_row['tn_ext']);
|
||||
|
||||
$thumbnail_title = $lang['hint_category'];
|
||||
|
||||
@@ -570,47 +570,32 @@ function get_templates()
|
||||
* returns thumbnail filepath (or distant URL if thumbnail is remote) for a
|
||||
* given element
|
||||
*
|
||||
* this function could have taken only the element id as parameter but to
|
||||
* optimize database access we directly ask file, storage category
|
||||
* identifier and extension since when this function is called,
|
||||
* PhpWebGallery should have all these infos. No need to retrieve them
|
||||
* another time in the database.
|
||||
*
|
||||
* the returned string can represente the filepath of the thumbnail or the
|
||||
* filepath to the corresponding icon for non picture elements
|
||||
*
|
||||
* complete directories are cached to be used more than once during a page
|
||||
* generation (many thumbnails of the same category on the same page)
|
||||
*
|
||||
* @param string file
|
||||
* @param int storage_category_id
|
||||
* @param string path
|
||||
* @param string tn_ext
|
||||
* @return string
|
||||
*/
|
||||
function get_thumbnail_src($file, $storage_category_id, $tn_ext = '')
|
||||
function get_thumbnail_src($path, $tn_ext = '')
|
||||
{
|
||||
global $conf, $user, $array_cat_directories;
|
||||
|
||||
if (!isset($array_cat_directories[$storage_category_id]))
|
||||
{
|
||||
$array_cat_directories[$storage_category_id] =
|
||||
get_complete_dir($storage_category_id);
|
||||
}
|
||||
|
||||
global $conf, $user;
|
||||
|
||||
if ($tn_ext != '')
|
||||
{
|
||||
$src = $array_cat_directories[$storage_category_id];
|
||||
$src.= 'thumbnail/'.$conf['prefix_thumbnail'];
|
||||
$src.= get_filename_wo_extension($file);
|
||||
$src = substr_replace(get_filename_wo_extension($path),
|
||||
'/thumbnail/'.$conf['prefix_thumbnail'],
|
||||
strrpos($path,'/'),
|
||||
1);
|
||||
$src.= '.'.$tn_ext;
|
||||
}
|
||||
else
|
||||
{
|
||||
$src = PHPWG_ROOT_PATH;
|
||||
$src.= 'template/'.$user['template'].'/mimetypes/';
|
||||
$src.= strtolower(get_extension($file)).'.png';
|
||||
$src.= strtolower(get_extension($path)).'.png';
|
||||
}
|
||||
|
||||
|
||||
return $src;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -71,6 +71,7 @@ column:storage_category_id table:images type:smallint
|
||||
column:representative_ext table:images type:varchar nullable:Y length:4 binary:N
|
||||
column:date_metadata_update table:images type:date nullable:Y
|
||||
column:average_rate table:images type:float nullable:Y length:5,2 signed:N
|
||||
column:path table:images type:varchar nullable:N length:255 binary:N
|
||||
column:user_id table:rate type:smallint nullable:N length:5 signed:N
|
||||
column:element_id table:rate type:mediumint nullable:N length:8 signed:N
|
||||
column:rate table:rate type:tinyint nullable:N length:2 signed:N
|
||||
|
||||
@@ -140,6 +140,7 @@ CREATE TABLE phpwebgallery_images (
|
||||
representative_ext varchar(4) default NULL,
|
||||
date_metadata_update date default NULL,
|
||||
average_rate float(5,2) unsigned default NULL,
|
||||
path varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (id),
|
||||
KEY images_i2 (date_available),
|
||||
KEY images_i1 (storage_category_id),
|
||||
|
||||
15
picture.php
15
picture.php
@@ -142,12 +142,7 @@ foreach (array('prev', 'current', 'next') as $i)
|
||||
$picture[$i]['is_picture'] = true;
|
||||
}
|
||||
|
||||
if ( !isset($array_cat_directories[$row['storage_category_id']]))
|
||||
{
|
||||
$array_cat_directories[$row['storage_category_id']] =
|
||||
get_complete_dir( $row['storage_category_id'] );
|
||||
}
|
||||
$cat_directory = $array_cat_directories[$row['storage_category_id']];
|
||||
$cat_directory = dirname($row['path']);
|
||||
$file_wo_ext = get_filename_wo_extension($row['file']);
|
||||
|
||||
$icon = './template/'.$user['template'].'/mimetypes/';
|
||||
@@ -165,7 +160,7 @@ foreach (array('prev', 'current', 'next') as $i)
|
||||
// special case for picture files
|
||||
if ($picture[$i]['is_picture'])
|
||||
{
|
||||
$picture[$i]['src'] = $cat_directory.$row['file'];
|
||||
$picture[$i]['src'] = $row['path'];
|
||||
// if we are working on the "current" element, we search if there is a
|
||||
// high quality picture
|
||||
// FIXME : with remote pictures, this "remote fopen" takes long...
|
||||
@@ -181,12 +176,10 @@ foreach (array('prev', 'current', 'next') as $i)
|
||||
// if picture is not a file, we need the download link
|
||||
if (!$picture[$i]['is_picture'])
|
||||
{
|
||||
$picture[$i]['download'] = $cat_directory.$row['file'];
|
||||
$picture[$i]['download'] = $row['path'];
|
||||
}
|
||||
|
||||
$picture[$i]['thumbnail'] = get_thumbnail_src($row['file'],
|
||||
$row['storage_category_id'],
|
||||
@$row['tn_ext']);
|
||||
$picture[$i]['thumbnail'] = get_thumbnail_src($row['path'], @$row['tn_ext']);
|
||||
|
||||
if ( !empty( $row['name'] ) )
|
||||
{
|
||||
|
||||
@@ -310,7 +310,7 @@ function get_filename_wo_extension($filename)
|
||||
|
||||
function get_pictures($dir, $indent)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $page;
|
||||
|
||||
// fs means FileSystem : $fs_files contains files in the filesystem found
|
||||
// in $dir that can be managed by PhpWebGallery (see get_pwg_files
|
||||
@@ -321,11 +321,15 @@ function get_pictures($dir, $indent)
|
||||
$fs_representatives = get_representative_files($dir);
|
||||
|
||||
$elements = array();
|
||||
|
||||
$print_dir = preg_replace('/^\.\//', '', $dir);
|
||||
$print_dir = preg_replace('/\/*$/', '/', $print_dir);
|
||||
|
||||
foreach ($fs_files as $fs_file)
|
||||
{
|
||||
$element = array();
|
||||
$element['file'] = $fs_file;
|
||||
$element['path'] = $page['url'].$print_dir.$fs_file;
|
||||
$element['filesize'] = floor(filesize($dir.'/'.$fs_file) / 1024);
|
||||
|
||||
$file_wo_ext = get_filename_wo_extension($fs_file);
|
||||
@@ -420,7 +424,7 @@ function get_pictures($dir, $indent)
|
||||
$xml = "\n".$indent.'<root>';
|
||||
$attributes = array('file','tn_ext','representative_ext','filesize',
|
||||
'width','height','date_creation','author','keywords',
|
||||
'name','comment');
|
||||
'name','comment','path');
|
||||
foreach ($elements as $element)
|
||||
{
|
||||
$xml.= "\n".$indent.' ';
|
||||
@@ -463,9 +467,9 @@ switch ($page['action'])
|
||||
|
||||
$end = strrpos($_SERVER['PHP_SELF'], '/') + 1;
|
||||
$local_folder = substr($_SERVER['PHP_SELF'], 0, $end);
|
||||
$url = 'http://'.$_SERVER['HTTP_HOST'].$local_folder;
|
||||
$page['url'] = 'http://'.$_SERVER['HTTP_HOST'].$local_folder;
|
||||
|
||||
$listing.= ' url="'.$url.'"';
|
||||
$listing.= ' url="'.$page['url'].'"';
|
||||
$listing.= '/>'."\n";
|
||||
|
||||
$listing.= get_dirs('.', '', 0);
|
||||
|
||||
Reference in New Issue
Block a user