Source for file images.php
Documentation is available at images.php
* Show a list of images in a long horizontal table.
* @author $Author: Wei Zhuo $
* @version $Id: images.php 27 2004-04-01 08:31:57Z Wei Zhuo $
require_once('config.inc.php');
require_once('Classes/ImageManager.php');
//process any file uploads
$upload_result= $manager->processUploads();
//process any directory functions
if($manager->deleteDirs() || $manager->processNewDir())
//check for any sub-directory request
//check that the requested sub-directory exists
if(isset ($_REQUEST['dir']))
if($manager->validRelativePath($path))
//get the list of files and directories
$list = $manager->getFiles($relative);
/* ================= OUTPUT/DRAW FUNCTIONS ======================= */
* Draw the files in an table.
foreach($list as $entry => $file)
<td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block">
<a href="javascript:;" onclick="selectImage(' <?php echo $file['relative'];?>', ' <?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);"title=" <?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"><img src=" <?php echo $manager->getThumbnail($file['relative']); ?>" alt=" <?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"/></a>
<!--<iframe src=" <?php echo $manager->getThumbnail($file['relative']); ?>"></iframe>-->
</td></tr><tr><td class="edit">
<?php if($IMConfig['allow_delete'] == true) { ?>
<a href="images.php?dir= <?php echo $relative; ?>&delf= <?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile(' <?php echo $entry; ?>');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a>
<!--EDIT IMAGE ; TEMPORALY DELETED-->
<!--<a href="javascript:;" title="Edit" onclick="editImage(' <?php echo rawurlencode($file['relative']);?>');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a>-->
<?php if($file['image']){ echo $file['image'][0]. 'x'. $file['image'][1]; } else echo $entry;?>
foreach($list as $path => $dir)
<td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block">
<a href="images.php?dir= <?php echo rawurlencode($path); ?>" onclick="updateDir(' <?php echo $path; ?>')" title=" <?php echo $dir['entry']; ?>"><img src="img/folder.gif" height="80" width="80" alt=" <?php echo $dir['entry']; ?>" /></a>
<a href="images.php?dir= <?php echo $relative; ?>&deld= <?php echo rawurlencode($path); ?>" title="Trash" onclick="return confirmDeleteDir(' <?php echo $dir['entry']; ?>', <?php echo $dir['count']; ?>);"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a>
<?php echo $dir['entry']; ?>
* No directories and no files.
<td class="noResult">No Images Found</td>
* No directories and no files.
<td class="error"> <?php echo get_lang('InvalidDirectoryPleaseCreateAnImagesFolder'); ?>
echo $manager->config['base_dir'];
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title>Image List</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="assets/imagelist.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="assets/dialog.js"></script>
<script type="text/javascript">
var topDoc = window.top.document;
var messages = topDoc.getElementById('messages');
messages.style.display = "none";
var topDoc = window.top.document;
//we need to refesh the drop directory list
//save the current dir, delete all select options
//add the new list, re-select the saved dir.
$dirs = $manager->getDirs();
var selection = topDoc.getElementById('dirPath');
var currentDir = selection.options[selection.selectedIndex].text;
while(selection.length > 0)
selection.options[selection.length] = new Option("/"," <?php echo rawurlencode('/'); ?>");
<?php foreach($dirs as $relative=> $fullpath) { ?>
selection.options[selection.length] = new Option(" <?php echo $relative; ?>"," <?php echo rawurlencode($relative); ?>");
for(var i = 0; i < selection.length; i++)
var thisDir = selection.options[i].text;
if(thisDir == currentDir)
selection.selectedIndex = i;
function editImage(image)
var url = "editor.php?img="+image;
Dialog(url, function(param)
if (!param) // user must have pressed Cancel
function closeWindowAfterUpload(path, name, width, height){
selectImage(path, name, width, height);
<script type="text/javascript" src="assets/images.js"></script>
<?php if ($manager->isValidBase() == false) { drawErrorBase($manager); }
elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?>
foreach($list as $entry => $file) {
echo "<script>closeWindowAfterUpload('". $file['relative']. "','". $entry. "','". $file['image'][0]. "','". $file['image'][1]. "');</script>";
$width= $list[1][$upload_result]['image'][0];
$height= $list[1][$upload_result]['image'][1];
echo "<script text='text/javascript'>selectImage('$relative$upload_result','$upload_result', '$width', '$height');</script>";
|