I just wonder if there is a way to make Thickbox provide us with an additional options to Display CCK Field. Currently, Thickbox provides an option to display an ImageCache preset with a link to the full image (original). Is it possible to have an ImageCache preset linked (via Thickbox) to another ImageCache preset? I have "thumbnail" and "preview" presets and want user to have "preview" displayed in thickbox when "thumbnail" is clicked.

Am I clear enough? :)

Tim

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

asak’s picture

Yes. i'm looking for this right now as well.

Using ubercart and looking to place a watermark on full-size images using thickbox + imagecache + imagefield - but can't figure out how to set the an imagecache preset for the "full size" images.

yakuza-fs’s picture

I was looking for it too... and made a custom version of Thickbox which provide you with additional selection box at admin/settings/thickbox where you can select prefered ImageCache preset to display linked images via Thickbox. This option is available only when Imagefield/ImageCache modules are installed. I was not coding for a long time, so please don't kick me if something if wrong in coding. So... I don't know how to create patches, so just download/replace these files and check Thickbox settings page.

For curious people, I have added the following code to thickbox.admin.inc

    // Adds an option to select ImageCache preset to use with ImageField images
    if (module_exists('imagecache')) {
      $presets_options = array("_original" => t('Original image (no preset)'));
      foreach (imagecache_presets() as $preset) {
        $presets_options[$preset['presetname']] = $preset['presetname'];
      }
      $form['thickbox_imagefield']['thickbox_imagecache_preset'] = array(
        '#type' => 'select',
        '#title' => t('ImageCache preset'),
        '#options' => $presets_options,
        '#default_value' => variable_get('thickbox_imagecache_preset', '_original'),
        '#description' => t('Select which ImageCache preset will be loaded.'),
      );
    }

as a part of

  if (module_exists('imagefield')) {
    ....
  }

Also, I've modified thickbox.module to proceed options above

    // If Imagefield/ImageCache modules exist then display image of a prefered IC preset
    if (module_exists('imagefield') && module_exists('imagecache')) {
      $preset = variable_get('thickbox_imagecache_preset', '_original');
      if ($preset == "_original") {
        $url_path = file_create_url($path);
      } else {
        $url_path = imagecache_create_url($preset, $path);
      }
    }

This code was added to theme_imagefield_image_imagecache_thickbox function.

Works great!!!
This functionality is enough for me but I will probably add an option to choose different presets for each ImageField instances (far going plans).

Would be great to see this functionality in the next version of Thickbox

frjo’s picture

Neat feature! I have committed the code by yakuza-fs, with some minor modifications, to 6-dev now. Please try it out and report back here.

yakuza-fs: How to create patches http://drupal.org/patch/create

frjo’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
Assigned: Unassigned » frjo
m4rt1n’s picture

at the moment i am using lightbox2 because i am missing this option in thickbox. could you please also provide this for the 5.x-2.x version?

drewish’s picture

frjo, so if you've committed it and there's been no complaints when do you close the issue?

frjo’s picture

Status: Active » Fixed

Usually after I here back from a few people but I finally have updated my own site to Drupal 6 and this is working well there. I close this and will release a new version shortly.

speis’s picture

this is great!

Status: Fixed » Closed (fixed)

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