Web app some advice required easy!!!

Soldato
Joined
22 Aug 2005
Posts
8,968
Location
Clydebank
Hello all

Wonder if anyone could give me some pointers here.

What I need is something really quick and dirty to do the following.

On a server machine, with a webserver installed, display a web page containing upto ~ 250 images in a column, beside each image is a tick box.

At the bottom is a submit button.

The idea is the user scrolls down (these are scanned forms, i.e every 8 or 16 or 12 or 24 images, the next form starts) anyway the user scrolls down, clicks the tick box beside each image of a front page, then clicks submit.

The it moves to the next directory and displays the next set of images.

The output of this should be a file that contains the full path to each image that was tick boxed.

I have scripts that take this file and process the images as required.

More wondering about quickly I can prototype the above idea using PHP/RUBY/ etc??? Any help here?


Currently the method employed is to use iorfanview, and the customiable external editor comman. Page through the images and hit SHIFT+E on the front page. This runs the external editor *(actually a batch script that just echoes the file name into an imglist.txt file.

Problems with this approach involve lots of client side setup. and General 'hackiness' of the solution and a bit of training for each user. If I could get a web page thing ther could be nothing easier than clickign the required tick box and hittign submit.


Regards.


Thanks for any input.
 
you can use php to do this, very easy. basically you'd want to look at using php to find out how many images there are in the folder, then roughly do a for loop which would go very roughly like this, start form, i=1, if i is less then the amount of images there is, display image 1, display an input checkbox field which has the value of the image, and then increase i by 1, so it becomes 2 then 3 then 4 etc. end form

then have php echo out checkboxs values or the link associated with the value which was submitted
 
OK I am attempting to get this done, PHP looks quite good for this, I downloaded and installed WAMP and coded this :
PHP:
<html> 
<head></head>
<body>

<?php


//define the path as relative
$path = "C:\test\gifs";
$fileNames = array();
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo "Directory Listing of $path</br>";

//running the while loop
while ($file = readdir($dir_handle)) 
{
   if($file!="." && $file!="..")
      echo "<a href='$file'>$file</a><br/>";
	  array_push($fileNames, $file);
}


//closing the directory
closedir($dir_handle);

echo "TEST READ BACK";
foreach ($fileNames as $a) { 
echo "<img src='$path\\$a' alt='$a'><br />";
}
?>
</body>
</html>
Now the question is how to get the images displaying from a location on the filesystem not in c:\wamp\www ? If I run the above the images don't display, but if i copy the image address from the image properties and then paste in my address bar it works.

I know it's a local address - but this shouldn't make any difference?

cheers
 
Last edited:
Hi . got the above solved with apache aliasing.


I'm looking for the way to read the array from a form with check boxes.

This code displays images (~300 128x128 thumbs) with their name and a check box beside each one. I want to when the user clicks submit echo back the filenames of whichever images had check boxes beside them.

heres the code:
index.php
PHP:
<html> 
<head></head>
<body>

<?php


//define the path as relative
$path = "/test/gifs";
$fileNames = array();
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo "Directory Listing of $path</br>";

//running the while loop
while ($file = readdir($dir_handle)) 
{
   if($file!="." && $file!="..")
     // echo "<a href='$file'>$file</a><br/>";
	  array_push($fileNames, $file);
}
$jobName = testjob;
$batchNo = 0524;
$operatorName = user;
$columnCount = 8 ;

//closing the directory
closedir($dir_handle);

// call function 
toppanel($jobName, $batchNo, $operatorName); 

?>
<STYLE TYPE="text/css">
<!--
TD{font-family: Arial; font-size: 10pt;}
--->
</STYLE>
<form action="index7.php" method="post"> 
<?php
// echo "TEST READ BACK<br>";
$colCount = 0 ;
$rowCount = 0 ;	

?>
<div align="center"><table border="1" id="table1" bgcolor="#AA99ED" cellspacing="1" bordercolorlight="#FFFFFF" bordercolordark="#808080"><tr>
<?php
foreach ($fileNames as $a) { 
	// echo "<img src='$path\\$a' alt='$a'border=10>";
?>
		<td><img src='<?php echo "$path\\$a" ; ?>' alt='<?php $a; ?>'border=2><BR>&nbsp;<input type="checkbox" name="<?php echo "$path\\$a" ; ?>" value="true">&nbsp;<?php echo $a; ?><P></td>
<?php
	$colCount = $colCount + 1 ;
	if ($colCount == $columnCount) { 
		echo  "</tr>" ;
		$colCount = 0 ;
	}
}
?>
</table>

</div>

Comments: <input type="text" name="comment" size="50"> 
<input type="submit" value="Send">
</body>
<?php
// define a function 
function toppanel($jobName, $batchNo, $operatorName) { 
?>
<div align="center">
	<table border="1" width="75%" id="table2">
		<tr>
			<td><b>Jobname: <?php echo $jobName; ?></b></td>
			<td><b>Batch: <?php echo $batchNo; ?></b></td>
			<td><b>Operator: <?php echo $operatorName; ?></b></td>
		</tr>
	</table>
	<P>
</div>
<?php
} 
echo "</html>";
?>

index7.php
PHP:
<html> 
<head></head>
<body>

<?php
//define the path as relative
$path = "/test/gifs";
$fileNames = array();
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo "Directory Listing of $path</br>";

//running the while loop
while ($file = readdir($dir_handle)) 
{
   if($file!="." && $file!="..")
     // echo "<a href='$file'>$file</a><br/>";
	  array_push($fileNames, $file);
}

// get form selection
$comment = $_POST['comment'];
// check value and select appropriate item
echo $comment;
foreach ($fileNames as $a) { 
//	echo $a;
	echo $_POST['$a'];
}

?>

</body>
</html>
 
Back
Top Bottom