Global "Update thumbs and/or resized photos" Global "Update thumbs and/or resized photos"
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Global "Update thumbs and/or resized photos"

Started by redtroll, November 17, 2004, 08:13:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

redtroll

I would like to have a global funktion for the "Update thumbs and/or resized photos" in the admin menu.
If I delete a folder containing a lot of images that is spread over several albums, then it would be great to do an "global refresh" of the entire database and delete all orphaned thumbs.
As for now, I have to do this for every album that is affected.

Maybe this is allready implemented?
I could not find anything in the forum...

/Paul


Joachim Müller

manually deleting files (using your ftp app) is not recommended once the files exist in the coppermine database, you should always use the coppermine interface to delete files (as only with this method everything related to the files is being deleted: full-size, intermediate, thumbnail, db entry, counter). Since the method you seem to use is not the recommended way to administer coppermine in the first place I doubt there will something like this. Setting up a routine to scan through the whole coppermine database and check if the needed files are still there is way to resource-consuming and not practical on larger galleries; the script would definitely time-out. You can update thumbnails and intermediate pics using the admin tools already by album - letting this script loose on the full gallery would result in the same: the script would time out.

I'm sorry, I have to turn your request down because it's not easily accomplished and it would encourage users to use/administer coppermine in an inappropriate way.

Joachim

m-a-b

is it possible to do a global update of the thumbs.

because i have hundreds of categories.

before thumbnails had a width of 80px or so now i have changed it in config-panel to 200.
so the thumbs look awful.

and to update every single categories with util.php would take too much time...

Nibbler


Joachim Müller

even if there were an option to process all pics in the database, the script would definitely time out (that's why you can only do this on a per-album basis). The remarks (the stuff next to the asterisks) on the config page should be pretty self-explanatory: re-doing all thumbnails is a huge strain on server resources, so you should have made your mind up on this before you started to add pics to the coppermine database.
If you feel adventurous you could edit util.php and change the query that does the thumbnail update to run several albums at once though (not recommended).

Joachim

paulaerison

#5
Quote from: GauGau on December 13, 2004, 05:58:50 PM
even if there were an option to process all pics in the database, the script would definitely time out (that's why you can only do this on a per-album basis). The remarks (the stuff next to the asterisks) on the config page should be pretty self-explanatory: re-doing all thumbnails is a huge strain on server resources, so you should have made your mind up on this before you started to add pics to the coppermine database.
If you feel adventurous you could edit util.php and change the query that does the thumbnail update to run several albums at once though (not recommended).

Joachim

something like


ob_start();                             'turn on output buffering.
do {
   set_time_limit(30);                 'should be enough time to finish working with an image or two (system dependant)
   do_some_stuff(with_var1, with_var2);
   print("What we just did!");
   flush();                           'flush the http buffer so what we just printed shows up and we don't wait for the whole script to finish
   ob_flush();                        'force the httpd engine to flush the contents of the buffer
} while ($more_stuff_todo_in_db);
ob_end_flush();                        'we're done with bufered output, so turn it off


heck, even throw in a sleep(10); to let the server have a chance to do something else.

should solve this problem just fine. (It will also solve a WHOLE lot of other timeout problems as well.)
see http://www.phpbuilder.com/manual/function.set-time-limit.php for more information on this function.

jeroenh

I've had the same problem. It is good to know that it will be in de next version. For now I've tackled the problem by modifying the function updatethumbs in util.php

In my scripts, utils.php starts at row number 131.

This is what I did:

row 135 : put '//' before $ albumid = $_POST['albumid'];
This is because we don't need it like this anymore. We'll use it in a different way

Row 141 : add some empty rows and put in the next code before row 141:

   $query2 = "SELECT aid FROM cpg132_albums";
   $result2 = MYSQL_QUERY($query2);

while ($row= mysql_fetch_array ($result2)) {


change the original row 141 with:

$query = "SELECT * FROM $picturetbl WHERE aid = $row[aid]";


After this, it doesn't matter what album you choose, it will allways update all thumbs.
I haven't expierienced any timeouts yet.


I know it isn't the prettiest way, but it is a hack that works untill the next version...