Advanced search  

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]

Pages: [1]   Go Down

Author Topic: [Solved]: how to refresh pictures info ?  (Read 5240 times)

0 Members and 1 Guest are viewing this topic.

zoram

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
[Solved]: how to refresh pictures info ?
« on: May 19, 2004, 09:07:52 pm »

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
« Last Edit: August 25, 2004, 07:57:20 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: how to refresh pictures info ?
« Reply #1 on: May 20, 2004, 06:17:47 am »

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
Logged

zoram

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: how to refresh pictures info ?
« Reply #2 on: May 20, 2004, 11:41:42 am »

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 :)
Logged

Nibbler

  • Guest
Re: how to refresh pictures info ?
« Reply #3 on: May 20, 2004, 08:05:18 pm »

Code: [Select]
<?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.
Logged

zoram

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: how to refresh pictures info ?
« Reply #4 on: May 22, 2004, 03:09:58 pm »

thks a lot, I try it straight away :)
Logged

Eastlight

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
    • larkinweb.co.uk
Re: how to refresh pictures info ?
« Reply #5 on: May 29, 2004, 12:21:14 pm »

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.

Code: [Select]
<?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
Logged

pixie

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: how to refresh pictures info ?
« Reply #6 on: August 24, 2004, 01:27:18 pm »

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.
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.