The Gallery2 migrate module is designed to import photos and related data from the Gallery package. This module works with Version 2 of Gallery (G2) and Drupal 7.

Some Drupal sites use the Gallery module to integrate G2 with Drupal. This module gives an upgrade path for those sites to Drupal 7. Instead of integrating with the Gallery package, this module imports the photos and metadata into Drupal.

For detailed instructions, caveats, warnings, etc., see README.txt.


I started using the Gallery package a few years before I started using Drupal. It is easy to install, and it works pretty well. When I started using Drupal, I used the Gallery module to integrate them. It provides highly configurable blocks, but it is tricky to configure (especially for a multisite installation) and it modifies .htaccess, which adds a step every time I update Drupal. (Sometimes I forget this step, which is not a good thing.)

It does not look as though there will be a version of the Gallery integration module for Drupal 7. On the other hand, D7 can manage media files much better than D6. I decided it is time to abandon Gallery and get all my photos into Drupal, so I wrote this module.


This module is based on the Migrate API. It depends on the following contributed modules:

Version 7.x-1.0-rc1 of this module has been tested with version 7.x-2.5 of the Migrate module, but does not work with versions 7.x-2.6 or later. As soon as I have a little time, I intend to release 7.x-1.0, with no changes to the code from the release candidate, but a note in the README about the compatible versions of Migrate. When I have more than a little time, I will update this module to work with the current version of Migrate.

If you want to use the Media module (7.x-1.x), then you need to enable the Migrate Extras Media sub-module (included with Migrate Extras), which depends on Media and related modules, and the Gallery migrate media submodule (included with this module). If you want to use core Image fields instead of Media, then you do not need these extra modules.

If you are using the same domain name as your old Gallery installation, and you want to redirect legacy Gallery pages to corresponding pages on your new site, then install the Redirect module. As of this writing, you will also have to patch the Redirect module: see the README for details.


Install like any other Drupal module. Installation will create a content type and two vocabularies as well as adding several (initially empty) tables to your Drupal database.

Once you have finished importing your Gallery photos, you may want to disable this module. You may also want to disable Migrate and Migrate Extras. If you uninstall this module, it will remove the database tables but it will not remove the content type nor the vocabularies. If you have imported data into your own content type and/or vocabularies, then you can remove the ones created when you installed this module.


The Migrate module is designed for large-scale migrations, so it should be able to handle even large Gallery installations. If you enable the Migrate UI submodule (migrate_ui), then you can use the interface at Administration > Content > Migrate (admin/content/migrate). You can also administer your migration using drush from the command line. The Migrate module has extensive documentation:

(The Caveats page includes some simple advice, probably based on hard experience.)

The Migrate module gives you the option of importing a limited number of items. It is a good idea to run some tests using this option before converting your entire Gallery installation.

Album view

This module includes a view to create an album out of your migrated photos. It should work as is if you use the content type supplied by the module. You can tweak the view, assuming that you have installed the Views and Views UI modules.

The view is styled by g2migrate.css. As usual, you can override this by adding a file of the same name to your theme folder.

There is some custom code in this module to display parent albums in the breadcrumb trail, with a select list for child albums. This will only work with the provided view.

A little (taxonomy) action

If you have albums that contain no photos, just sub-albums, then they will look pretty barren if you use the view. This module provides an action that will attach to a node one or more parent terms of each term already attached. You can apply the action using the Views bulk operations (VBO) module. (You could also use the action with the Rules module or with the core Trigger module. For example, you could set it up so that every time a node is created or updated, ancestor terms are added along with any taxonomy terms.)

Redirect from the legacy pages

The module contains integration with the Redirect module. This will generate redirects from legacy Gallery pages to corresponding pages on your new site, provided that you use the same domain name as your old Gallery installation. As of this writing, you will also have to patch the Redirect module: see the README for details.

Live sites

  • I have a web site with over 1,000 photos imported from Gallery2. I developed the view first on this site, before adding it to this module.
  • First of all thank you so much for the module! I'm not sure if I would have been able to upgrade to drupal 7 without it.

    -- @alforddm, Color Genetics.

Project Information