make gallery on another machine make gallery on another machine
 

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

make gallery on another machine

Started by laszlo_laszlo, November 17, 2006, 03:29:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

laszlo_laszlo

Hi Everybody,

First off all sorry my poor english. It is not my mother language.
I've a coppermine gallery on my server. Lot of people visit my site every day.
When I batch add pictures, the gallery will be very slow. I've got an another machine (much stronger). I want to generate the new albums with batch add pictures on this another machine, and after I want just upload to the server. I know I need export some database tables and I must import this table rows in to the servers database table. What tables store the pictures informations? What tables data need to import in to the server? Is this possible?
Thank you


Hein Traag

Why not host CPG on the stronger machine ?

Cheers!
Hein

laszlo_laszlo

Because my stronger machine is my laptop :)
The servers hardware:
AMD64 3000+ CPU (single core)
1 GB DDR RAM
2 SATA2 HDD (RAID1)

My laptop:
Intel Core Duo T2300 CPU
2 GB DDR RAM

Is it possible to generate the new albums in my laptop then upload to the server. I saw cpg_pictures table contain the pictures information. If I export from my laptop the new rows and import in to the servers database will be good?
If I change the servers CPU to a dual core AMD64 will be faster the batch add image process? When I start the batch add image, I see the linux servers processes with top command. I see ~5 or 6 process. I use ImageMagick. Can I limit the ImageMagick process number in the coppermine? I think if only one ImageMagick process start the server do not slow down. Am I right?

Hein Traag

Try not to post more then 1 question in a thread.

If you add the pictures to your CPG on the laptop you could also try to then copy the newly created album folder over the other computer and add the pictures in that CPG. I did it once and it only added the pic info to the CPG database and did not, as far as i could see, redo all image sizes. This might save you the trouble of moving database tables from one to a other database.

Cheers!
Hein

laszlo_laszlo

Thank you very much. I will try it as soon as possible.

Joachim Müller

Ah, the joys of self-hosting ::)...

Just for clarification: what makes the server slow down during batch-add is the fact that you (ab-)use your server to resize the pics. Setting up another server on the more powerful machine and then moving resized pics back and synchronizing the databases of the two servers is just a waste of time. Batch-resize the pics on your client (the more powerful machine), then upload the whole enchilada to the server and perform the batch-add script: if the resized pics already exist, the resources-consuming resizing on the server doesn't have to be performed and only the (light-weight) database operations will be run. Subsequently, you'll notice no lag or performance penalty of the server during batch-add.

As an example: if you have set your max dimension to 1024, use a tool like IrfanView to batch-resize all your pics that you're going to upload to resize them to a max aspect of 1024. Then re-run IrfanView's batch-resize tool this time with the dimension of your intermediate-sized images setting and the option turned on to batch-rename as well: just change the names of those files in the second round of resizing, matching the name to be prefixed with your intermediate images (default: "normal_"). Then perform the batch-resize and batch-rename a third time with the max dimensions of your thumbs and the prefix you chose for thumbs (default: "thumb_"). After having created those three sets of files, move them to your server and finally perform batch-add there. Details can be found on http://coppermine-gallery.net/tutorial/irfanview1.php

Another workaround would be to use the Batch add with automatic album/cat structure from directory tree.-mod and only add a few pics in one go.

laszlo_laszlo

Thank you very much the detailed howto. I use only Linux. I will write a tiny shell script which will use ImageMagick. It can resize and rename the pictures like IrfanView. When I finish this script I will post to this forum. Thanx again!

laszlo_laszlo

#7
As I promised I wrote a little bash script for Linux users:
(my coppermine gallery use intermediate pictures with max width: 400px and thumbnail max width is: 140px)

#!/bin/bash
echo "Please add your new albums name: ";
read NEWNAME;

I=1;
SZAM=`ls *.jpg | grep -ic .jpg`;
for img in `ls *.jpg`
do
    if [ $I -lt "10" ];
        then
        NEWNAME2="$NEWNAME"_00"$I".jpg;
    fi

    if [ $I -lt "100" ] && [ "9" -lt $I ];
        then
        NEWNAME2="$NEWNAME"_0"$I".jpg;
    fi

    if [ "99" -lt $I ];
        then
        NEWNAME2="$NEWNAME"_"$I".jpg;
    fi
    W=`identify -format "%w" $img`;
    Y=`identify -format "%h" $img`;
    Y=$[Y-24];
    /usr/bin/convert $img -thumbnail '140>' thumb_$NEWNAME2;
    /usr/bin/convert $img -thumbnail '400>' normal_$NEWNAME2;
    mv $img $NEWNAME2;
    echo "Picture: $SZAM/$I is done.";
    I=$[I+1];
    NEWNAME2="$NEWNAME".jpg;
done



It is work me fine. I know this is not the best script, but it is working.

[Edit GauGau] Put your script's code into more readable form by using the [ c o d e ]-tag [/Edit]