/[drupal]/contributions/sandbox/walkah/image/45/update-images.php
ViewVC logotype

Contents of /contributions/sandbox/walkah/image/45/update-images.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Thu Feb 17 19:29:58 2005 UTC (4 years, 9 months ago) by walkah
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
And the 4.5 compatible version...
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 ?>

  ViewVC Help
Powered by ViewVC 1.1.2