Currently selected image

mixman - August 16, 2009 - 13:37
Project:Taxonomy Image
Version:6.x-1.x-dev
Component:Contrib Attach
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi

I've using the dev version and found a bug in taxonomy_image_attach.module on line 81. When getting the currently selected image, the query is wrong.

I don't have the time to create a patch, but here's a quick fix for it (maybe somebody can integrate into the next release):

    // Reverse-lookup to figure what this attached image is, if any.
      $file = db_fetch_object(db_query("SELECT * FROM {files} f LEFT JOIN {image} i ON i.fid = f.fid WHERE f.filepath = '%s'", $current_filepath));
      // If none, no problem.

      $all_images = taxonomy_image_attach_get_image_nodes();
      $form['taxonomy_image']['image_attach']['iid'] = array(
        '#type' => 'select',
        '#title' => t('Use existing image'),
        '#options' => $all_images,
        '#default_value' => $file->nid,
        '#description' => t("Choose from existing image nodes."),
        '#prefix' => '<strong>'. t('or:') .'</strong>',
      );
      // TODO: Ajax to display the one you just chose?

 
 

Drupal is a registered trademark of Dries Buytaert.