I'm transcribing information from .jpg files. I have my form set up, but as it is now, I have to have the photos open in another window to read them, and use a <select> form field to list all the file names using this code:

$files = array();
$dh = opendir($dirname) or die ("Couldn't open directory.");
while (false !== ($filename = readdir($dh))) {
	$files[] = $filename;
	sort($files);
}
foreach ($files as $option) {
	echo "<option>$option</option>\n";
}

It's working fine, but my project has gotten too big for one person, and I'm going to need to have people help me. Also, some of my image directories have thousands of files in them, and it's taking forever to generate the list.

I'm using "header" when the form is submitted to bring up a "clean," new form.

So what I'd like to do is have the image appear on the form page itself, and when the form is submitted, the form is "refreshed" with the next image showing and a clean form to fill out.

It also needs to make sure that there isn't already information entered for that particular image file, but I think I already know how to do that.

I just don't know where to start. Hope this makes sense.

It seems that your page that lists the files should be able to open the form for the transcription and pass the name of the next file.

Conceptually, your list of files could be part of a form with a radio button beside each one. You would click on the submit button to open a new window with the form. The name of the file to be used would be passed based on which radio button was checked. The transcription form page would have an <img statement to open the graphic being processed. The user would enter the info, and click enter for the transcription form. This could open a "success" page or it could just go directly back to the page that shows the list. That would receive the name of the file that was just processed as a parm so it could automatically check the next one in the list as the default. You would just cycle back and forth between the two forms as you work your way down the list. You could do fancier things with Ajax but this is the simple straightforward way to do it. Given the large number of files, you probably don't want to have to re-list them each time so read on.

If you don't really need the list except to drive the process, then you could probably eliminate displaying the list at all and just cycle from one transcription form to the next passing the current file name /number so the form can automatically go to the next file. This would avoid the issue of displaying thousands of files on each cycle through this. There might still be a performance issue rebuilding the list each time (even without displaying it), so you might want to build an array with all of the file info (as a session variable) so you only have to do it once at the start.

I presume that the transcription process is recording more than just the name of the file and adding stuff like a description of the content (that must be done by humans). With thousands of files, this sounds like a pretty tedious and time-consuming process.

Thank you for your help. Your second scenario is what I'm looking for, and would be the most practical considering the number of images in some of the directories. But I don't know how to write the code to do that, i.e., passing to the next file. Well, I know how to do *that* but I don't know how to write the code to determine what the next file name is. I only know how to list all the files. :-)

You are correct -- I am transcribing tombstones and recording cemeteries for a genealogy project. It is very tedious and time consuming -- which is why I need to collect some helpers. By myself, they'll be transcribing *my* tombstone before I can get it all done. :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.