Advanced search  

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

Pages: [1]   Go Down

Author Topic: [Solved]: Batch update thumbnails, is there a better way then this?  (Read 11283 times)

0 Members and 1 Guest are viewing this topic.

net

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 88

Hello CPG,

I am going through a rough time trying to update all 300 000 thumbnails on my gallery from 100 to 125 dimensions.

I am using the "util.php" script to do this, however i get timeouts after around 15 hours. Since almost 40% of the gallery is already updated with the thumbnails is there a way to resume? Is there a way for me to see where the last thumb was updated through the database?

I assume the script takes all pictures in "pid" order from the cpgxxx_pictures table.

I know i could sit and update 10 000 pictures at a time but this would require me to be in front of the computer more then i am.

Thankful for any suggestions, i tried to search but didn't find anything to help me.

Thank you.
« Last Edit: February 29, 2008, 08:02:20 am by Joachim Müller »
Logged

Nibbler

  • Guest
Re: Batch update thumbnails, is there a better way then this?
« Reply #1 on: February 28, 2008, 09:26:02 pm »

I think Stramm's modpack has an automatic 'continue' feature for admin tools.
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Batch update thumbnails, is there a better way then this?
« Reply #2 on: February 28, 2008, 09:29:13 pm »

yup, the modpack will update thumbs/ images without you having to click 'continue' all the time. You can set each batch to a small number (eg. 5 images at a time) to avoid timeouts.

net

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 88
Re: Batch update thumbnails, is there a better way then this?
« Reply #3 on: February 28, 2008, 09:31:13 pm »

Interesting! Is there a way to single out this script only, i'm afraid to install mod-packs as i've modified my gallery heavly already. There might be issues.

Thanks for the quick help!
Logged

Nibbler

  • Guest
Re: Batch update thumbnails, is there a better way then this?
« Reply #4 on: February 28, 2008, 09:46:11 pm »

You can hack it in.

Edit util.php

find

Code: [Select]
        $albumid = (isset($_POST['albumid'])) ? $_POST['albumid'] : 0;
        $albstr = ($albumid) ? "WHERE aid = $albumid" : '';

        $updatetype = $_POST['updatetype'];
        $numpics = $_POST['numpics'];
        $startpic = (isset($_POST['startpic'])) ? $_POST['startpic'] : 0;

change to

Code: [Select]
        $albumid = (isset($_REQUEST['albumid'])) ? $_REQUEST['albumid'] : 0;
        $albstr = ($albumid) ? "WHERE aid = $albumid" : '';
        $autorefresh = $_REQUEST['autorefresh'];
        $updatetype = $_REQUEST['updatetype'];
        $numpics = $_REQUEST['numpics'];
        $startpic = (isset($_REQUEST['startpic'])) ? $_REQUEST['startpic'] : 0;

then find

Code: [Select]
        if ($count == $numpics){

                $startpic += $numpics;

        echo <<< EOT
                <form action="util.php" method="post">
                                <input type="hidden" name="action" value="update_thumbs" />
                                <input type="hidden" name="numpics" value="$numpics" />
                                <input type="hidden" name="startpic" value="$startpic" />
                                <input type="hidden" name="updatetype" value="$updatetype" />
                                <input type="hidden" name="albumid" value="$albumid" />
                                <input type="submit" value="{$lang_util_php['continue']}" class="button" />
                        </form>
EOT;
        }

change to

Code: [Select]
       if ($count == $numpics){

                $startpic += $numpics;
if($autorefresh) {
echo <<< EOT
<meta http-equiv="refresh" content="1; URL=util.php?numpics={$numpics}&startpic={$startpic}&albumid={$albumid}&autorefresh={$autorefresh}&action=update_thumbs&updatetype={$updatetype}">
EOT;
}
else
{
        echo <<< EOT
                <form action="util.php" method="post">
                                <input type="hidden" name="action" value="update_thumbs" />
                                <input type="hidden" name="numpics" value="$numpics" />
                                <input type="hidden" name="startpic" value="$startpic" />
                                <input type="hidden" name="updatetype" value="$updatetype" />
                                <input type="hidden" name="albumid" value="$albumid" />
                                <input type="hidden" name="autorefresh" value="$autorefresh" />
                                <input type="submit" value="{$lang_util_php['continue']}" class="button" />
                </form>
EOT;
}

Logged

net

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 88
Re: Batch update thumbnails, is there a better way then this?
« Reply #5 on: February 28, 2008, 10:01:45 pm »

Wow, thanks for the support, works great!

Thank you.
Logged

dem_

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • ST Racing
Re: [Solved]: Batch update thumbnails, is there a better way then this?
« Reply #6 on: October 01, 2008, 04:19:52 am »

 ???

when i hack it in i get this error


Parse error: syntax error, unexpected $end in /home/content/d/e/m/demdagieu/html/cpg6/util.php on line 532

i did copy and paste, several times, and then used the replace function of my dreamweaver so there are no typing errors...

im using cpg 1.4.19, i think is relaeted to the second section of code because i do the firt section and the page shows, do the second section and the error shows...

line 532 its the very end of the file
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [Solved]: Batch update thumbnails, is there a better way then this?
« Reply #7 on: October 01, 2008, 07:40:52 am »

Rename your copy of util.php to util.php.txt and then attach it to your posting. Don't use Dreamweaver to edit files, but a regular plain text editor, as Dreamweaver probably applies some code "beautifications" on it's own.
Logged

dem_

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • ST Racing
Re: [Solved]: Batch update thumbnails, is there a better way then this?
« Reply #8 on: October 01, 2008, 11:27:52 am »

im gonna feel pretty stupid, when you point out the comma i left out...

thanks for the prompt response
Logged

Nibbler

  • Guest
Re: [Solved]: Batch update thumbnails, is there a better way then this?
« Reply #9 on: October 01, 2008, 02:43:30 pm »

You need to post the modified file that doesn't work, not the original.
Logged

dem_

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • ST Racing
Re: [Solved]: Batch update thumbnails, is there a better way then this?
« Reply #10 on: October 01, 2008, 07:02:36 pm »

 :-[

my bad that was the back up... apparently the brain closes after 4:00 :)

Quote
Reply #8 on: Today at 04:27:52 AM
Logged

Nibbler

  • Guest
Re: [Solved]: Batch update thumbnails, is there a better way then this?
« Reply #11 on: October 01, 2008, 07:32:13 pm »

You have a brace missing at the end of the update_thumbs() function.
Logged

dem_

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
    • ST Racing
Re: [Solved]: Batch update thumbnails, is there a better way then this?
« Reply #12 on: October 01, 2008, 08:21:23 pm »

Excelent... it now works for me I also had to set the autorefresh to 1 oterwhise it will not refresh on its own...


Here is the original Code
Code: [Select]
       
if ($count == $numpics){

                $startpic += $numpics;

        echo <<< EOT
                <form action="util.php" method="post">
                                <input type="hidden" name="action" value="update_thumbs" />
                                <input type="hidden" name="numpics" value="$numpics" />
                                <input type="hidden" name="startpic" value="$startpic" />
                                <input type="hidden" name="updatetype" value="$updatetype" />
                                <input type="hidden" name="albumid" value="$albumid" />
                                <input type="submit" value="{$lang_util_php['continue']}" class="button" />
                        </form>
EOT;
        }



Working Code (for me) is the same only changed 2 things
Code: [Select]
1 if ($count == $numpics){
2
3                $startpic += $numpics;
4 if($autorefresh) {
5 echo <<< EOT
6 <meta http-equiv="refresh" content="1; URL=util.php?numpics={$numpics}&startpic={$startpic}&albumid={$albumid}&autorefresh={$autorefresh}&action=update_thumbs&updatetype={$updatetype}">
7 EOT;
8 }
9 else
10 {
11         echo <<< EOT
12                 <form action="util.php" method="post">
13                                 <input type="hidden" name="action" value="update_thumbs" />
14                                 <input type="hidden" name="numpics" value="$numpics" />
15                                 <input type="hidden" name="startpic" value="$startpic" />
16                                 <input type="hidden" name="updatetype" value="$updatetype" />
17                                 <input type="hidden" name="albumid" value="$albumid" />
18                                 <input type="hidden" name="autorefresh" value="1" />
19                                 <input type="submit" value="{$lang_util_php['continue']}" class="button" />
20                 </form>
21 EOT;
22 }}

on line 18 changed the autorefresh value to "1" otherwise its always false thus not refreshing
on line 22 added and extra "}" just like Lord Nibbler pointed out :)
Logged
Pages: [1]   Go Up
 

Page created in 0.035 seconds with 19 queries.