filtering the files already in db at the batch upload ? filtering the files already in db at the batch upload ?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

filtering the files already in db at the batch upload ?

Started by _dopehead_, August 25, 2004, 12:20:45 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

_dopehead_

How would i go about chainging searchnew.php so that the batch upload feature only shows me the files that are actually new and not already in the db ? As it is right now if i have a directory with say a few hundred files in it the batch upload shows me all those files just without the checkbox marked. I would like it not to show those files, seeing as i have no use for seeing what is already inserted into the db and thumbnailed, but only new files are interesting.

Jan

Casper

Can I suggest you create more subdirectories, with not so many pics in each.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

_dopehead_

Well, the real reason for wanting this is acually that if the batch upload only showed files not in db yet, i would be able to do all my batch thumbnailing from one page by choosing the root dir and then it will go through all dirs to find only those pics not in the db yet. Quite usefull when you download many pics every day and update many different dirs with only a few pictures in each.

Jan

Casper

There has been quite a lot of discussion about this.

It would place a huge load on the server if it had to check evey pic on it and only select those that are not present in the db to display.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Joachim Müller

Casper's right: displaying the browser is one thing that is time-consuming (could easily be removed from the code, so thumbnails are not being displayed that already exist in the database). However, your initial problem is not solved then: the script will have to go through all files in the folder, look them up, decide if they already exist and then display them or not - this is a very time-consuming process that is bound to bring your server (or rather the batch-add process) down sooner or later. I recommend doing what was suggested before: upload to multiple, different folders (and subfolder).
The process of displaying (nested) folders can become resources-consuming as well, so we're looking into a method of browsing the tree structure in an explorer-like manner (displaying only one level of the tree at a time) - will probably be in the next coppermine version though (for large site setups).

GauGau

_dopehead_

How about this then :  When someone uploads a file in a directory the timestamp on that directory's modified date will change. Why not have the batch process check just the date of the dirs and only display those that where changed in comparison with some new field in the db ? This would keep it from going through dirs with no new files in it, and so lifting the processor load of the server.

Jan

Joachim Müller

the time stamp of a folder that has been created a year ago will remain the same, even if you uploaded files to it yesterday. Your setup appears to be rather "exotic", most users use the batch-add process the way it is suppossed to be, that's why I vote for leaving the process as-is (with the changes I suggested above). It's not so easy to do file manipulations with php that work on all server setups, that's why we try to code it in a way that works for almost all setups. Reading time stamps of files is not so easy and reliable.

GauGau

_dopehead_

So, modified date on a directory is not always available under php ? i guess it would depend oin the hosts o/s.

I can see the problem then, i think i will try to code something that maintains this information myself. Guess i have to learn php then :-)

Jan

_dopehead_

Hmm, just been learning some php today and got some directory datecheck routine thrown together, modified date seems to work fine on my own IIS5 and on my hosting providers Linux/apache platform.

_dopehead_

I just had an idea that i would like some sparring on : How about using the META refresh tag in the html code so the client reloads and only creates say 30 thumbs at a go ? that would make the script not timeout and i think the refresh tag is supported in almost all browsers used today. Then when the script has finished all the thumbnailing/updating db you could just remove the meta tag and replace it with a "finished" page.

Jan

_dopehead_

Another question from the nagging new member :  I am trying to compare the file modify date with the mtime in the pictures table this however shows up wrong like August 2038 and something, clearly wrong. how should i format that string in php ?

Also i am checking the ctime entry and found that as an ex. one file shows :

sitepics/Actresses/Amy Weber/AmyWeber-WWERaw080904-juggo-01.jpg ctime : August 13 2004 21:48:40 File Modified : August 13 2004 21:47:01

I am using the filemtime function in php to get the filesystems modified date.

How is this possible ?


Code :
{
    global $CONFIG;

   $sql = "SELECT filepath, filename, ctime " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE filepath LIKE '%Amy Weber%'";
 
    $result = db_query($sql);
    while ($row = mysql_fetch_array($result)) {
    echo $row['filepath'] . $row['filename'] . date ("F d Y H:i:s",$row['ctime']) . ' Modified : ' . date ("F d Y H:i:s",filemtime('albums/' . $row['filepath'] . $row['filename'])) . '<BR>';
      $count++;
}       
      echo $count;   
    mysql_free_result($result);
}