MyGallery To WordPress Converter
This Code Is No Longer Maintained!
Recently, I ranted about how WordPress did not give me a clear way to upgrade from external plugins like MyGallery to new features that have been absorbed into “core”. Finally, I decided to do something about it, and thankfully, everything is open sourced, and so I actually could do something about it. And now that I have, maybe I should make it available publicly as well. Now, be forewarned, this is not a plugin which I intend to maintain very much, since I only need to use it once myself. But it could be useful to others.
In short, this plugin helps to convert galleries that use the MyGallery Plugin by Thomas Boley to use the WordPress attachments system and built-in gallery shortcode that comes with WordPress 2.5 or newer.
If you are:
- unclear about full backups/restores of WP Tables and All Files,
- or are not really comfortable with thinking about mucking around with php or sql tables,
- or are just not sure what to do and what this plugin is for,
- or have no idea what I’m talking about . . .
then please, do not use this plugin, because you may lose valuable data! This is a plugin for advanced and experienced WordPress users.
This plugin will attempt to convert MyGallery installations and related shortcodes to the new WordPress Gallery attachments and shortcode system. The actual image files used by MyGallery are kept in the same place and merely added to WordPress. Please note that not all MyGallery shortcodes are converted, so some manual editing is still required. Also, the conversion is only performed on published posts - unpublished drafts, revisions, etc are ignored.
This plugin will directly change WordPress tables, post data, and files in MyGallery. A full backup, ready to restore, is required - better still if you can try it first with on a “mirror” of your blog before actually doing it on the live one.
After the conversion is complete, you will probably still have to go through your blog posts to verify if the layouts are correct. Some (many?) page layouts may need to be edited and changed because there are no exact matches between the layout options in MyGallery shortcodes and WordPress. So, after the conversion is complete, please print or save the results page as a reference of the changes that were made so that you know which pages/posts to check/edit.
Also, due to the fact that WordPress attachments make use of parent/inherited posts as a way to associate posts with the attachments, the conversion process will associate attachments to the first matching published post. Therefore, having the same MyGallery gallery on multiple pages will probably not convert properly. Watch out for “(Previously Added) Parent Post ID:” in the results to indicate that an attachment has been used more in more than one posts.
Steps to take:
- Upgrade your blog to WordPress 2.6
- If you have to, disable your MyGallery plugin, but do not delete it or any of the files/tables, etc
- Install and activate this plugin
- Run this plugin and follow its instructions, the conversion process can take a long time to work, so please be patient!
- Print/save the results page as a reference of the changes that were made
- Once the conversion is complete, check your blog to make sure it is working properly. If things go bad, restore from backup and review what went wrong before trying this again
- Check/Edit all pages for layout/correct conversion etc
- Disable/Delete this plugin
- Disable/Delete MyGallery Plugin
- You can remove the “mygallery”, “mygprelation” and “mypictures” tables from your WordPress Database
- You can remove the “tumbs” folder from each of your MyGallery gallery folders in the “myfotos” folder, but do not remove the “myfotos” folder or any of the gallery folders inside it, they have been added to the WordPress attachments system
All changes made by this plugin are irreversible - use this plugin at your own risk!
Latest Update (2008-08-23): Made a bugfix to import the description and caption (alttext) fields from MyGallery into WordPress as well. Also, added a variable to allow users to change the path of their MyGallery installation from the default wp-content/myfotos/ directory. You will need to edit the plugin php file to change this variable (near the top).