[Solved]: how to refresh pictures info ? [Solved]: how to refresh pictures info ?
 

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

[Solved]: how to refresh pictures info ?

Started by zoram, May 19, 2004, 09:07:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zoram

Hi,

To avoid running out of space, I downloaded all the pics of my galeries, increased the jpeg compression level, and uploaded them back by ftp. I didn't feel like asking every member to re optimize and re upload their pictures :)

It worked fine, exept in the infos displayed under the pictures, the file size does not correspond to the new size of the pictures. Similarly, the space used by every user  in the user table still display the old values.

It is not a big deal, but is there a way to actualise those data ?

Thks

Joachim Müller

you could have used the "resize pictures" admin utility to re-create intermediate files and thumbnails with the compression settings from coppermine config, but this wouldn't have changed the full-sized pictures (which are usually the trouble makers when webspace is concerned), so basically you did the right thing. There's no built-in option to re-caluculate the file sizes (and the quota used), sorry. If you really need the file sizes to be accurate, you'll have to edit the values directly in the database (using a tool like phpMyAdmin), sorry...

GauGau

zoram

Well, I expected that answer :)
I can't be bothered changing manually the value for every pic, but I d like to modify the quota usage data. I'm curently trying to locate it in php my admin. Could you indicate me in which table I can find it ?

Thanks :)

Nibbler


<?php

define
('IN_COPPERMINE'true);

require(
'include/init.inc.php'); 
$path '/home/nibbler2/public_html/albums/';
$result db_query("SELECT `pid`, `filepath`, `filename` FROM {$CONFIG['TABLE_PICTURES']} ORDER BY `pid` ASC");

while (
$row mysql_fetch_array($result)) {
$db_filename =  $row['filename'];
$db_filepath =  $row['filepath'];
$pid =  $row['pid'];
$full_pic_url $path $db_filepath $db_filename;
$thumb_url $path $db_filepath 'thumb_' $db_filename;
$normal_url $path $db_filepath 'normal_' $db_filename;
echo "Updating pic $pid ...<br />";
$filesize filesize($full_pic_url);
$thumb_filesize filesize($thumb_url);
$normal_filesize = @filesize($normal_url);
$total_filesize $filesize $thumb_filesize $normal_filesize;
$result2 db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET `filesize` = '$filesize', `total_filesize` = '$total_filesize' WHERE `pid` = '$pid' LIMIT 1");
}
?>




copy/paste that into a php file, put it in your coppermine dir, run it. Will update all your filesizes. Change $path to the real path of your albums directory on the server. Quota usuage is calculated from these numbers each time it is needed I believe.

zoram

thks a lot, I try it straight away :)

Eastlight

Hi there,

I had the same problem as the OP and have used the script by Nibbler above to reset the file sizes and it worked brilliantly! Thanks for that. I also had the problem with the dimensions so I modified Nibbler's script to update the file sizes. 

I only needed to change the dimensions of the full size pics to that's all that's in the script here.


<?php
define
('IN_COPPERMINE'true);

require(
'include/init.inc.php'); 
$path 'albums/';
$result db_query("SELECT `pid`, `filepath`, `filename` FROM {$CONFIG['TABLE_PICTURES']} ORDER BY `pid` ASC");

while (
$row mysql_fetch_array($result)) {
$db_filename =  $row['filename'];
$db_filepath =  $row['filepath'];
$pid =  $row['pid'];
$full_pic_url $path $db_filepath $db_filename;
echo 
"Updating pic $pid ...<br />";
$size getimagesize ("$full_pic_url");
$result2 db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET `pwidth` = '{$size[0]}', `pheight` = '{$size[1]}' WHERE `pid` = '$pid' LIMIT 1");
}
?>



Again, the $path needs to be changed to your path.

HTH,
James

pixie

Thanks you so much, Nibbles and Eastlight, you guys are a genius!
just the script i'm looking for to update my thousands of pics with non existent dimension info due to porting from another gallery db.