We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Porting Photo Gallery Module to Matrix so it can be upgraded to EE2

Development and Programming

noregt's avatar
noregt
360 posts
15 years ago
noregt's avatar noregt

Hi everyone,

I’d like to share how I’ve managed to move the Photo Gallery module to Brandon’s Matrix entries, so it can be upgraded to EE2. It wasn’t as hard as I thought it would be, so it might help others too. I’ve noticed that more people are in need of a way to convert their Photo Gallery Module from EE1 to EE2. I am at least, in fact I did not make the jump to EE2 yet, partly because I’m using the Photo gallery on different sites with about 1000 images.

So, as I see it, the best way to prepare the transfer to EE2 is to move all images to regular entries. I’ve used Brandon’s Matrix as a replacement, because that comes closest to the way the photo gallery module works.

I’ve done the move with SQL queries, mostly in PHPmyadmin.I decided to move a complete Photo Gallery category to one single entry, containing a Matrix table with three columns.

Essentially the data needed to be moved from exp_gallery_entries to exp_matrix_data.

First you need to make an entry with matrix setup in three columns representing the image, the title and the caption.

In phpmyadmin you should be able to see the columns (col_id) that are produced by this entry and the field_id that holds the matrix. The following query would then insert all images from gallery category 3 in three matrix columns which are here 6,7,8. Filename and extension are joined as one entry.

INSERT INTO exp_matrix_data (col_id_6, col_id_7, col_id_9) SELECT title, concat(filename, extension), caption FROM exp_gallery_entries WHERE cat_id=3

The last thing I needed to do was to add the entry_id and field id to the added rows in exp_matrix_data table. Here the entry id was 369, the field used for matrix was 10 and the rows added started at 200:

UPDATE exp_matrix_data SET entry_id=369, field_id=10 WHERE row_id > 200

And that was it. I then dumped all medium and thumbfiles. Instead, I used CE image to resize the files.

This is of course completely at your own risk, I made a copy of the database and tried that first to be sure.

I’ve understood that the tables from the gallery module are still there in EE2, so this method could be used there as well I think.

So maybe there are even quicker ways to solve this? If not I hope this will help others too.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.