| 1 |
<?php
|
| 2 |
|
| 3 |
include_once 'includes/bootstrap.inc';
|
| 4 |
include_once 'includes/common.inc';
|
| 5 |
|
| 6 |
$fields = array('thumb_path' => 'thumbnail',
|
| 7 |
'preview_path' => 'preview',
|
| 8 |
'image_path' => '_original');
|
| 9 |
|
| 10 |
if (function_exists('_image_insert')) {
|
| 11 |
$result = db_query("SELECT * FROM {image}");
|
| 12 |
while ($old_image = db_fetch_object($result)) {
|
| 13 |
foreach ($fields as $old => $new) {
|
| 14 |
$old_file = '';
|
| 15 |
if (file_exists($old_image->$old)) {
|
| 16 |
$old_file = $old_image->$old;
|
| 17 |
} else {
|
| 18 |
$old_file = file_create_path($old_image->$old);
|
| 19 |
}
|
| 20 |
if ($old_file &&
|
| 21 |
db_num_rows(db_query("SELECT fid FROM {files} WHERE nid=%d and filename='%s'", $old_image->nid, $new)) == 0) {
|
| 22 |
_image_insert($old_image->nid, $new, $old_file);
|
| 23 |
}
|
| 24 |
}
|
| 25 |
}
|
| 26 |
}
|
| 27 |
|
| 28 |
?>
|