Several years ago I upgraded my static website to Drupal 6 combined with Gallery2 for my photos. Not longer after that Drupal 7 and Gallery3 came out, but G3 wasn't compatible with Drupal 7. 3.1 was supposed to be, but it was taking a while for it to come out. I held off on updating my site. My site was beginning to get stale, and I wasn't sure what to do, when word came down that the Gallery team decided to throw in the towel, 3.1 won't be coming out. My site was having some issues with Drupal 6, it was time to upgrade. But to what?
I wanted to upgrade to at least Drupal 7 (8 was still too new) but what do I do with my photos? I had over 100 stories and 10,000 photos, I wanted something that would migrate easily. Drupal's gallery support was supposed to be better in 7, but it still wasn't very good. After searching around, to see what others had done, I found Benji Fisher's Gallery2Migrate module. This looked exactly what I wanted. It would upgrade my site to a 100% Drupal site. I set out on my upgrade journey. While I am a programmer in my day job, one of my goals was to minimize the amount of coding I had to do.
The Journey Begins
My first step was to upgrade my site to Drupal 7. It was fairly straightforward. But almost all of my 6 modules were no longer being used.
G2Migrate isn't the simplest module to use, as there are some manual steps. but the documentation lays out everything you need to do. This module imports your photos into a node, and your gallery structure into a taxonomy tree. It also provides a gallery view with a breadcrumb to navigate the gallerys, and a grid view for the photos.
G2Migrate did a wonderful job importing my photos, but now I needed to clean up the rest of my site. I also wanted a better visual for browsing the galleries. I was able to add a photo to each taxonomy term (my original G2 implementation had this, it would have been nice if G2migrate also migrated these) Then I created a new view the taxonomy structure that showed the thumbnails of the taxonomy photos. This allowed one to traverse the taxonomny tree.
Before I started the migration path, I'd discovered Juicebox, and I liked how it displayed galleries. I wanted to use Juicebox to show the actual gallery. I created another view that used a juicebox view (from the JuiceBox module) This view would collect all the nodes for a given taxonomy and present it in a juicebox gallery.
The problem was I wanted my gallery view to lead to my juicebox view. If a taxonomy term had children it should show the next gallery view, otherwise it should link to the juicebox view. I couldn't figure out how to do this. And while there may be another solution, I couldn't find it at the time. This is the one time I had to write some code. I wrote a view hook that created a field. The field would return one word if the taxonomy term had children, and a different word if it had no children. Since I was lazy I just hardcoded the words. Now I could create a link made up of this new field and the taxonomy term. With this module in place I could navigate the entire taxonomy tree. If you were in the tree you saw a grid of thumbnails, and if you were on a leafnode you would see a juicebox view.
Migrate Old Urls
The next step was to clean up my articles, and get them working again. I embed thumbails of photos into the articles. The old site linked to a lightbox version of the gallery for a given photo. I had chosen not to use the redirect portion of the G2Migrate module. I was just going to recreate all my interior links. What I really wanted to do was replace all the links with something like [[node:45]] or something. Turns out that is exactly what node embed does. But I had two problems, one is I wanted to show just the thumnail, and the other is I had pointers to the old G2 ids, and I needed to change them to the new drupal node id.
Before I can go about changing the ids, I needed to figure out how to display just the thumbnail. Node embed is great, but it literally embeds a node where you specify, almost as if it is in an iframe. With node embded you can specify which view to display, [[ NID:1 view_mode=TEASER]] would show the teaser view. I was able to create a thumbnail view, and turn off all fields but the photo. But there are still some fields you can't control (why drupal, why?) Display Suite to the rescue. Display Suite allows you to do a better job of controlling exactly what the view shows. I got the thumbnail down to a couple of divs and the thumnbail. But the divs had a default display of block, I wanted them to be inline. I broke down and added some CSS to G2Migrate to set the CSS for the new view to inline. The thumnails now showed up just as thumbnails, inline.
But I still needed to replace all of the urls and change the ids. Benji helped me out here, and pointed to the database table that mapped the G2 ids to the Drupal ids. Another piece of code I wrote, to parse a story, look for a URL with a particular class, parse out the gallery id, look the id up in the database, find the drupal id, and replace the whole url with [[nid:id thumbnail]].
The Last Step
I'm almost there, I've got a gallery that is browesable, I've got stories with thumbnails. But clicking on the thumbnail goes to the drupal node. Ideally it would go to the juicebox gallery. But I'm currently using the free juicebox offering, which doesn't allow deep linking into a gallery. So I was willing to settle on going to the drupal photo node as long as I can include a link to the gallery. But the link goes to the taxonomy term view. I hindsight I might have been able to change the taxonomy term view, but I already had a juicebox view. I setup chaos tools with page manager. With page manager I was able to redirect the taxonomy term to the juicebox page.
Whew! It took a few more modules than I expected, but I manged to convert my drupal 6/gallery2 to drupal 7. There are still a few things that aren't quite 100% (for example if you show the taxonomy breadcrumb I think you'll end up jumping to a juicebox gallery which doesn't work if you are in the tree somewhere, and not a leaf node) I haven't gotten to the point where I upload a new gallery and store. I suspect it will be a bit more work than it was before. But on the other hand I think the new site is a bit more powerful that it was before.
Now I just need to find a good theme!