It would be great to be able to crop images uploaded to taxonomy using the taxonomy image module.

I've had a look, but I'm not quite clear on how I would add this capability in.

Cheers,
Steph

Comments

kfritsche’s picture

I have in one of my module following code to do this

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  if ("taxonomy_form_term" == $form_id) {
    // ONLY FOR VOCABULARY WITH VID = 3 (for me...)
    if ($form['#vocabulary']['vid'] == 3) {
      $form['taxonomy_image']['#collapsed'] = FALSE;
      if (!empty($form['taxonomy_image']['current_image'])) {
        $fid = db_result(db_query("SELECT f.fid FROM {files} f LEFT JOIN {term_image} i ON f.filename = i.path WHERE i.tid=%d", $form['#term']['tid']));
        $form['taxonomy_image']['current_image']['croptab'] = array(
          '#type' => 'item',
          '#value' => imagecrop_linkitem($fid),
          '#weight' => -10,
        );
      }
    }
  }
}

You can set then all cropping formats for this vocabulary. There are no settings (to enable it for specific vocabularies and/or disable some cropping formats). For the moment it works fine for me, maybe someone have time to write a proper patch and add some settings. Also don't know where to publish this (taxonomy image? imagecache javascript crop? own module?)
Maybe it helps you till there is an official support.

nils.destoop’s picture

I'll look to add this after D7 version.

nils.destoop’s picture

Status: Active » Fixed

Support for taxonomy_image has been added

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gooddesignusa’s picture

Status: Closed (fixed) » Needs work

Seems like this option was removed. Might of been my mistake when I provided a patch for jcrop. http://drupal.org/node/1291446#comment-5082878
It was removed around here: http://drupalcode.org/project/imagecrop.git/commitdiff/d05cfe5169216124e...
I'm working on a website that could use this so hopefully this can be worked back in. I can try to re apply anything related to taxonomy image and see if it works.

nils.destoop’s picture

Status: Needs work » Closed (fixed)