Last updated 24 January 2012. Created on 3 December 2008.
Edited by digodrupal, batigolix, Shane Birley. Log in to edit this page.

There have been some issues surrounding the upgrade path for the image module from Drupal 5 to Drupal 6.

In order to successfully upgrade, you need to:

Prepare Your Drupal 5 Install

  1. backup your database
  2. upgrade to the latest image 5.x.-1.x module
  3. then upgrade to the latest image 5.x-2.x module

Upgrade to Drupal 6

  1. backup your database
  2. follow the Drupal 5 to Drupal 6 upgrade instructions
  3. upload and install the latest image 6.x-1.x version of the image module (or other appropriate release)
  4. run update.php
  5. that should do it

Why

The key here is a code structure change in the image module in version 2.x that is important to update prior to your upgrade to Drupal 6.

Note

At the moment, the image module is in alpha and you must always be careful when dealing with alpha code. The current alpha is fairly stable but you should always, always, test the module prior to using it on a live production site. If you have any problems, please document any errors you receive and review the open issues list for the image module. If you do not find any immediate solution, post a support request with as much description as possible.

References

http://drupal.org/node/219808#comment-811682
http://drupal.org/node/219808#comment-1011071

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

robertgarrigos’s picture

I found my self upgrading my drupal 5 site, with image module 5.x-1.x, to drupal 6 without knowing that I should have upgraded first the image module 5.x-1 to the 5.x-2 branch. However, I believe I managed to do the drupal 6 update by running these two mysql queries prior to run the drupal 6 update:

CREATE TABLE image ( `nid` INTEGER UNSIGNED NOT NULL, `fid` INTEGER UNSIGNED NOT NULL, `image_size` VARCHAR(32) NOT NULL, PRIMARY KEY (`nid`, `image_size`), INDEX image_fid(`fid`) ) /*!40100 DEFAULT CHARACTER SET utf8 */;

INSERT INTO image SELECT DISTINCT u.nid, f.fid, f.filename FROM files f INNER JOIN upload u ON f.fid = u.fid WHERE f.filename IN ('_original', 'thumbnail', 'preview')

Note that the table names are not between brackets as I run these queries direct on mysql. Remember to add any prefix you have in your database configuration.

Also, the second query has a list of sizes ('_original', 'thumbnail', 'preview') which needs to be updated with the sizes you are using. In my case I had a custom one called 'petita' so my list of sizes really was ('_original', 'thumbnail', 'preview', 'petita').

Finally, these queries seemed to work but I haven't test everything yet on my site, so don't take risks and ALWAYS do backups before attempting any change on your database

---
Robert Garrigos
Professional site: http://garrigos.cat
Catalan Drupal Users Group: drupal.cat

david.archibald’s picture

Thanks for this - I did exactly the same and was starting to do a minor panic altho I had the option of rolling back to the backup. It appears to have worked perfectly.

Yep, need to remember about the prefix too!

v8powerage’s picture

I wonder how to update this module from 4.7 to 5 it seems that the table is changed from files to image, but that's all that I can tell, Is anybody can help me with this?

pelicani’s picture

It removes duplicates and non existent files.
Another thing the upgrade from 4.7 to 5 does is clean up the files.

The upgrade query takes a long time.
I altered the query with a LIMIT just to make sure it was working.
Still took a long time, but works.
Then I removed the LIMIT and ran it overnight, worked.

I found these pages helpful...
http://drupal.org/files/issues/image-issues-FAQ.txt
http://drupal.org/node/208785

Web Developer : Philadelphia, PA