forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: net on February 28, 2008, 09:18:21 pm
-
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.
-
I think Stramm's modpack has an automatic 'continue' feature for admin tools.
-
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.
-
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!
-
You can hack it in.
Edit util.php
find
$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
$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
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
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;
}
-
Wow, thanks for the support, works great!
Thank you.
-
???
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
-
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.
-
im gonna feel pretty stupid, when you point out the comma i left out...
thanks for the prompt response
-
You need to post the modified file that doesn't work, not the original.
-
:-[
my bad that was the back up... apparently the brain closes after 4:00 :)
Reply #8 on: Today at 04:27:52 AM
-
You have a brace missing at the end of the update_thumbs() function.
-
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
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
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 :)