Download & Extend

Thickbox + ImageCache + ImageField wider integration

Project:Thickbox
Version:6.x-1.x-dev
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:frjo
Status:closed (fixed)

Issue Summary

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

Comments

#1

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.

#2

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

AttachmentSize
thickbox.admin_.inc_.txt 3.67 KB
thickbox.module.txt 6.58 KB

#3

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

#4

Version:6.x-1.0» 6.x-1.x-dev
Assigned to:Anonymous» frjo

#5

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?

#6

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

#7

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.

#8

this is great!

#9

Status:fixed» closed (fixed)

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

nobody click here