been there. took photos.

Impressions - lots of them

  • Home
  • Timeline
  • Albums
  • Content
  • Essays
Home / Essays / 2017 / January / Migrating Gallery3 to Koken
Share
29 January 2017

Migrating Gallery3 to Koken

I had to get rid of Gallery3 without losing all my pictures and albums. Fortunately, I found Koken as a possible replacement. It turned out that there is also is quite simple way to migrate Gallery3 to Koken - thanks to Daniel Muller.
His migration scripts can be found here: https://github.com/DanielMuller/gallery_to_koken

Three issues occured:
- Galleries were obviously imported but not shown as albums
- Aspect ratio was a bit messed up
- Several images were not shown

A few SQL statements later, they were solved:
update koken_albums set level=1;
update koken_content set aspect_ratio = width/height;
update koken_content set filename = replace(filename, ' ', '_');

Obviously, filenames on disk should match those in the database:

find . -name "* *" | while read FILENAME; do mv "$FILENAME" $(echo $FILENAME | tr ' ' '_'); done;

Finally, get the urls nice and clean:
url.rewrite-if-not-file = (
  "^/koken/admin($|/.*)" => "$0",
    "^/koken/storage/cache/images(/[0-9]{3}/[0-9]{3}/.*)$" => "/koken/i.php?path=$1",
    "^/koken(/[^?]*)(\?(.*))?" => "/koken/app/site/site.php?url=$1&$3"
)

coffee @ Tiong Bahru Bakery
Langkawi - Pantai Cenang
View all essays by month
Links
  • Home
  • Albums
  • Content
  • Essays
© Patrick Diddens