Upgrading to Drupal 7.20 and Fixing Broken Image Paths

2 min read

On a project that is still in development, we recently did a core upgrade as part of our pre-launch preparations. The project involved a data migration of tens of thousands of nodes and users; part of the migration involved manual cleanup of image data to account for a responsive design in the new site and different use of screen real estate between the old site and the new site.

However, as is noted on the 7.20 Release Notes, there are some issues that can arise on sites using the Insert module after upgrading to Drupal 7.20. The diff on the release notes page for the 7.20 release gives a sense of how the ramifications of these issues are still evolving; given that there are a little over 42,000 sites reporting use of Insert in D7, there will likely be other people affected by issues similar to what we experienced.

What We Experienced

After we upgraded, none of the images that had been inserted into text areas via the Insert module were displaying. The images were still present in the file system, but given that they were derivatives created via imagecache, it would have taken a single flush of imagecache, or a modification to an image style, and poof! the stored version is gone, making the pre-existing path to the image even more useless.

As is noted in this issue, older versions of the Insert module don't work cleanly with Drupal 7.20. As several commenters posted in that issue, all relative links no longer worked. This issue led to the creation of a sandbox project that begins to address the issue. However, cleaning up pre-existing content is heavily dependent on the site in which that content was created or edited.

Next Steps

After researching the issue, Jeff developed an update script that we tested in dev prior to rolling live on staging.

As mentioned above, the specifics of updating content will vary based on your precise site configuration, so the chances of this script working cleanly on your site with no modification is virtually nil.

However, in the interest of saving the next people to face this issue some time, the script is on GitHub; please fork away and have at it.

, ,