As I posted a while back, they killed Gallery3. And finally I found the time to move (also I was getting annoyed of restraining myself from posting more pictures on the outdated software). Here are some pointers I would have liked to have for the migration :
First, in gallery3 it was okay to drop pictures in no album, in the root folder. In Piwigo, I believe it is NOT possible, and at least the migration script will ignore pictures left in the root folder. So before you make the switch, you should create a new album and put the pictures from the root folder into it. Or just take the time to finally sort those pictures ๐
While you’re there, check if you don’t have picture file names with quotes in them, as Piwigo doesn’t support that (and anyway you just shouldn’t use that kind of characters in file names). From the comments, it looks like ampersand (&) is bad voodoo too.
After that, it’s mostly straightforward:
– download Piwigo. I used the “package” but I suppose the “webinstall” works just as well
– install it following the instructions there
– once Piwigo is installed go to the administration panel, then to Plugins > Manage, then to the “Other plugins available” tab and install the plugin “Menalto2Piwigo”
– once Menalto2Piwigo is installed, go to Plugins > Menalto2Piwigo, and follow the instructions:
* step 1) Copy the content of g2data/albums (Gallery2) or var/albums (Gallery3) into [your piwigo folder]/galleries
* step 2) Go to Tools > Synchronize. At this step, you can have an error “PWG-UPDATE-1” when trying to import some files. It is caused by “forbidden” characters in file names, like spaces. Fortunately, the list of allowed characters can be configured: to do so, copy include/config_default.inc.php
as local/config/config.inc.php
, then locate $conf['sync_chars_regex']
. It’s a regex of allowed characters, just add there the characters you need. For instance, I just needed to add spaces so my new line is $conf['sync_chars_regex'] = '/^[a-zA-Z0-9-_. ]+$/';
. See this forum thread if you need more details.
* step 3) Submit the form on the page: means obviously you need to put the parameters of your gallery3 database in there (screenshot)
* step 4) Install and activate plugins Extended Description: I’m not sure how useful it is but I did it anyway and it doesn’t seem to do any harm.
And voilร , migration complete, although you might want to check for corrupted characters if your database encodings don’t match (my Gallery3 was non-UTF-8 while my Piwigo is UTF-8, I lost quite a few French characters in the move :().
A little complement now: I had some ads and stat tracking (Piwik) code on my Gallery 3, here is how I added them back. Also by default Piwigo will expose your e-mail address on your gallery, not cool so we’ll deal with that too.
I put my ad code in the header, and actually I didn’t need to edit code for these as I found the subheader was a decent place to put them. In the admin panel, go to Configuration > Options, and then in the first tab you have a “Page banner” section where you can put HTML code, like:
<iframe data-aa='348' src='//ad.a-ads.com/348' scrolling='no' style='width:320px;height:50px;border:0px;padding:0;overflow:hidden;margin-left:20px;' allowtransparency='true'></iframe>
<iframe data-aa='348' src='//ad.a-ads.com/348' scrolling='no' style='width:320px;height:50px;border:0px;padding:0;overflow:hidden' allowtransparency='true'></iframe>
If you prefer to move it around a bit, you can probably find a good fit placing your ad code directly inside themes/default/template/header.tpl
.
I put my stat tracking code in the footer, and that’s where the e-mail address is too. The file to edit is themes/default/template/footer.tpl
.
For the e-mail, locate the section with “if isset($CONTACT_MAIL)”, and comment the block you want to remove with {* (that’s the comment start) and *} (that’s the comment end). NB: note the comment above saying you shouldn’t remove the “Powered by Piwigo” part, so make sure you don’t comment out too much!
For the stat tracking, you know the drill: just before </body>, as usual, so you can put your code just a few lines above the end of the file.
Last note: we edited the default theme, which means if you configure your gallery to use another theme, well you need to edit that theme instead.
…and that’s all, congrats on moving! I must say I found gallery3 smoother (even though I’m definitely not a design addict), but sticking to unmaintained software is bad, so…
Update: many customizations can be done using plugins
@plegall on Twitter pointed out that most of my above customizations can be done without touching the code but by using plugins:
– to remove the e-mail in footer, plugins “Contact Form” + “Protect Notification”
– to add Piwik or *cough* Google Analytics stats, plugin “Statistics”
– to add the regex to the config file, plugin “LocalFiles Editor”, and also note that, of course, you can limit the content of your modified config.inc.php to the values that you did modify
Update (2018-07-24): where is the database configuration stored?
I’m currently migrating to a new server, and one thing that drove me crazy is that I spent an indecent amount of time looking for my Piwigo database password (I use random passwords that are unique per-application and that I don’t store anywhere, except where it’s required in the application). The Piwigo forums were not helpful, possibly because the search is, let’s say, hard to get working right ๐ So in the end I just downloaded all my Piwigo installation and opened it locally in Visual Studio Code, which provide a nice search that made it easy to find where my database name was stored, which, obviously, was kind of next to the password.
Long story short, the database credentials are stored in local/config/database.inc.php
. Why the hell the obvious “config” folder was hidden away in the goddamned “local” folder is beyond my understanding. But at least now I’ll know it’s there.
Recent Comments