I have use the weight feature of the pre 4.6.0 image.module to define the order in which the images are displayed in my galleries. The 4.6.0 image.module does not have this feature, the order of display is determined by the creation time of the images. In order not to have to change a few hundred images, I changed update-image.php to change the creation time according to the old weights:
<?php
/**
* Copy this file to your drupal installation root and run from a web browser
*
* BACK UP YOUR IMAGES FIRST!
*/
//THEO modified
include_once 'includes/bootstrap.inc';
include_once 'includes/common.inc';
// leave preview out, because I don't have them
//$fields = array('thumb_path' => 'thumbnail',
// 'preview_path' => 'preview',
// 'image_path' => '_original');
$fields = array('thumb_path' => 'thumbnail',
'image_path' => '_original');
if (function_exists('_image_insert')) {
$result = db_query("SELECT * FROM {image}");
while ($old_image = db_fetch_object($result)) {
// change the created time of the image node according to the weight in the image table
// print "****weight: ".$old_image->weight." ".$old_image->nid." " ;
$res = db_query("SELECT created FROM {node} WHERE nid = '$old_image->nid'");
$pnode = db_fetch_object($res);
// print " created ".$pnode->created;
$pnode->created -= $old_image->weight * 3600 ;
// print " : ".$pnode->created;
db_query("UPDATE {node} SET created = '$pnode->created' WHERE nid = '$old_image->nid'");
// now copy the images to the files directory and the table
foreach ($fields as $old => $new) {
$old_file = '';
if (file_exists($old_image->$old)) {
$old_file = $old_image->$old;
} else {
$old_file = file_create_path($old_image->$old);
}
if ($old_file &&
db_num_rows(db_query("SELECT fid FROM {files} WHERE nid=%d and filename='%s'", $old_image->nid, $new)) == 0) {
_image_insert($old_image->nid, $new, $old_file);
}
} // end of foreach loop
}// end of loop for each image
}
?>
I took an offset of 3600 s, as I created the galleries with the now gone fast upload feature, thus the creation times of all the images in one gallery were within 1 hour.
If you have already converted your images by running update-image.php, you can run the above code with the lines for the conversion (the foreach loop) taken out.
Note that I also removed the preview_path as I had no images in it.