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: One user folder problem (need help)  (Read 2700 times)

0 Members and 1 Guest are viewing this topic.

matonka007

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
One user folder problem (need help)
« on: January 06, 2014, 10:31:15 pm »

I have a big problem. My hosting provider wants to block my website. Because I have a gallery of more than 30,000 photographers in one folder. I need help. The folder is / albums/userpics/10001 /

All photos are single user. How can I split the files into multiple folders? I can not have more than 1000 files in a single folder (Regulation hosting provider). Please help. Tell me that this is possible. :'(
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: One user folder problem (need help)
« Reply #1 on: January 07, 2014, 12:12:03 am »

1,000 file limit per folder? Or did you mean 10,000?
1,000 is not very Coppermine friendly... Since a single photo can easily have an original, normal,  and thumb - that is only 333 pictures per folder....

Splitting 'normal' folders isn't a big deal - but user galleries aren't 'normal' - as they tie the folder name to the user_id... I'll have to dig and see if subfolders are supported for user folders - unless one of the other devs can answer.

Just to see - I verified with my ISP - and the only limit imposed is 500,000 inodes - any combination of files, directories, mail messages, and symlinks. 
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: One user folder problem (need help)
« Reply #2 on: January 07, 2014, 01:44:14 am »

A quick test - and while uploading a user pic doesn't give a choice of folders - I was able to take existing pics and move them to a subfolder - with corresponding update to cpg_pictures to update the filepath for those files... Of course all related (original, thumb, normal) need to move together...

The FileMove plugin allows moving from/within the userpics folder - just define the destination folders in your file system first - and I'd suggest keeping the destination to a subfolder within the original users folder...
You can download FileMove from http://sourceforge.net/projects/coppermine/files/Plugins/1.5.x/
Direct link: http://sourceforge.net/projects/coppermine/files/Plugins/1.5.x/cpg1.5.x_plugin_FileMove_v1.3.zip/download

May be other plugins suitable as well - just found that one first.

A possibility might be some kind of automated maintenance task that checks the folders (could be just   userpics - or all) - and if something is approaching the limit or over a threshold - copy contents to a subfolder and update database accordingly...  If your limit is really 10,000 - working on a threshold between 5-7K would should stop anyone from exceeding between runs... A 1,000 limit would be challenging...

Hope that helps...
« Last Edit: January 07, 2014, 02:09:49 am by gmc »
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: One user folder problem (need help)
« Reply #3 on: January 13, 2014, 03:10:27 pm »

I'll have to dig and see if subfolders are supported for user folders - unless one of the other devs can answer.
I've added a hidden config option in cpg1.5.x some time ago for just that reason:
Code: [Select]
        // Upload pictures in a sub-directory named according to the album ID
        if ($CONFIG['upload_create_album_directory']) {
            $filepath .= '/'.$album;
            $dest_dir .= '/'.$album;
            if (!is_dir($dest_dir)) {
                mkdir($dest_dir, octdec($CONFIG['default_dir_mode']));
                if (!is_dir($dest_dir)) {
                    echo sprintf('error|'.$lang_db_input_php['err_mkdir'].'|1', $dest_dir);
                    exit;
                }
                @chmod($dest_dir, octdec($CONFIG['default_dir_mode'])); //silence the output in case chmod is disabled
                $fp = fopen($dest_dir . '/index.php', 'w');
                fwrite($fp, ' ');
                fclose($fp);
            }
        }

This code creates a sub-directory for each album in each user directory the user uploads files to. To enable that feature, you manually need to add a new database entry to the config table (name "upload_create_album_directory", value "1"). This of course applies just for new uploads, existing files need to be moved either with the plugin Greg already referred or with an automated script (which doesn't exist yet).
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.