Reply to Re: Fax server question.

Your name:

Reply:


Posted by Steve on 10/18/05 20:10

> I would like to build up a web page, which will show me files, which are fax
> files (image files) (from fax server).

We need more information on your setup. Are the descriptions to be
stored in a database or a flat file? Sounds like you need two separate
applications: a viewer application that lists the descriptions with
links to the images; and a maintenance application that lets users add
a description for a particular image.

You don't say if the list is static or not, although you imply that at
some time or other you don't know the file names. The maintenance
application will have to scan the fax image files folder to see if any
new files have been added. Collect the list of files from that folder
and compare with the known list in your database/flat file. If there
are any new ones, add them to your database.

$faxlist = array();
$fh = opendir( '/path/to/fax/files/' );
while( false !== ( $file = readdir( $fh ) ) )
{
// exclude folders...
if( $file != "." && $file != ".." && $file != "" )
{
// check file type...
$path_parts = pathinfo( $file );
if( $path_parts[ 'extension' ] == 'fax' ) // whatever the
image ext is
{
// add to list...
$faxlist[] = $path_parts[ 'basename' ];
}
}
}
closedir($fh);
sort( $faxlist );
reset( $faxlist );
foreach( $faxlist as $faxname )
{
// print "<a
href=\"showfax.php?faxfile=$faxname\">$faxname</a><br />";

if( !exists_in_my_database( $faxname ) )
{
add_to_my_database( $faxname );
}
}

Functions exists_in_my_database() and add_to_my_database() depend on
your setup.

> I would like have the files on the list on web page, because I would like to
> link the these image files
> with some descriptions, which is taken manualy by a user. What is the best
> solution to link the file from fax server
> with the descriptions.

I would use a database to store filename and description, plus any
other useful metadata that would be useful - such as file creation
date, so that old fax files can be purged later.

Don't store the image files in the database, it's a waste of resources.
Leave them in the filesystem and save the filename only. Displaying the
fax image depends on the image file format. If they are JPEG, GIF or
PNG then use header() to tell the browser what type of image and the
appropriate image output function (See
<http://www.php.net/manual/en/ref.image.php>.) If they are TIFF, hmmmm.
External application needed, I think.

---
Steve

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация