Zoomify & Ubercart 2 Product Catalog
| Project: | Zoomify |
| Version: | 6.x-1.4 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
I'm building a parts-book site for a client, and am using the Ubercart 6.x-2.0 shopping cart with D6.14 to manage the ecommerce side of things. I have parts books with very detailed schematics that I would like to apply Zoomify to (the scaled-down images are too small to see part numbers and notes), and these images are stored in UC2 as what appears to be an Imagefield attached to a taxonomy term in the UC2 Catalog vocablulary. I have installed the imagecache module, and the UC2 catalog is using the uc_thumbnail preset (oddly enough) for these top-of-the page parent category images.
What would you recommend as the best way to apply Zoomify to these UC2 catalog images? The "catalog browser" pages are managed by the uc_catalog.module code. I'm using a theme that does not use a template engine (derived from base D6.14's installed Marvin, which is derived from Chameleon). I also don't want Zoomify used on all images on the site, just the ones in the UC2 catalog browser for the category image at the top of the page.
You can see what I'm talking about by visiting:
http://octobang.com/isettasrus/catalog/18
Thanks for any suggestion or ideas you can provide as to how best to tackle this. I've gotten no traction on the UC website forums, and hoped that maybe you had some insights. I'm relatively new to Drupal, so might very well have overlooked some obvious way to make Zoomify work in this scenario.
-R

#1
I'm unfortunately not familiar with either template-less themes or UC2. So I can only give you general ideas:
* If UC2 uses CCK ImageField, that means the taxonomy terms are somehow related to nodes of some content type. In Zoomify settings, select that node type. This will ensure that whenever a new image is uploaded, it is zoomified.
* You can zoomify your existing images using Views Bulk Operations and the "Create or update Zoomify tiles" action that was added in Zoomify 6.x-1.4, released just today.
* To fix the display, the usual route is to override a theme function, as explained on the Zoomify module page. The Chameleon theme has a chameleon.theme file. Perhaps your own theme can (or does) have one too. In that case, you need to find the name of the theme function used by UC2 to display that catalog page for which you provided a link. You can then override that theme function in your own .theme file.
#2
If you already have one large image and one small image, the fastest way is to use Magic Touch. You don't need to create SWFs for each zoom. You just use a class of MagicTouch and link to the JavaScript file.
#3
kratib - it looks like, after more investigation, that UC2 is using hook_form_alter to add a field to the taxonomy term form and managing the image data itself:
/**
* Implementation of hook_form_alter().
*
* Add an image field to the catalog's taxonomy term form.
*/
function uc_catalog_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'taxonomy_form_term' && $form['vid']['#value'] == variable_get('uc_catalog_vid', 0)) {
$form['#attributes'] = array("enctype" => "multipart/form-data");
$form['identification']['name']['#weight'] = -1;
$form['identification']['image']['#weight'] = 0;
$form['identification']['image']['image'] = array('#type' => 'file',
'#title' => t('Image'),
'#weight' => 0,
);
$image = uc_catalog_image_load($form['tid']['#value']);
$imagecache = module_exists('imagecache');
if ($image) {
if ($imagecache) {
$image_display = theme('imagecache', 'uc_category', $image->filepath);
}
else {
$image_display = theme('image', $image->filepath, t('Term image'));
}
$form['identification']['image']['remove'] = array('#type' => 'checkbox',
'#title' => t('Remove category image: !image', array('!image' => $image_display)),
'#weight' => 1,
);
}
if (!$imagecache) {
$form['identification']['image']['image']['#description'] = t('The image will not be resized. Consider installing <a href="@url">Image cache</a>.', array('@url' => url('http://drupal.org/project/imagecache')));
}
$form['identification']['description']['#description'] = t('A description of the term. Displayed to customers at the top of catalog pages.');
}
}
It does however theme the image as a class when it displays the term's image using the Imagecache module where I need to apply Zoomify to it:
...if (!empty($catalog->image)) {
if (module_exists('imagecache')) {
$output .= theme('imagecache', 'uc_thumbnail', $catalog->image['filepath'], tt('taxonomy:term:'.$catalog->tid.':name', $catalog->name), tt('taxonomy:term:'.$catalog->tid.':name', $catalog->name), array('class' => 'category'));
}
else {
$output .= theme('image', $catalog->image['filepath'], tt('taxonomy:term:'.$catalog->tid.':name', $catalog->name), tt('taxonomy:term:'.$catalog->tid.':name', $catalog->name), array('class' => 'category'));
}
}
...
Being that I'm still getting a handle on the hook system, is there a way maybe I could intercept the "uc_thumbnail" class object somewhere via theming and modify the IMG object to add Zoomify functionality to it?
Magic Toolbox - the images I need to zoom into are over 6MB in size, at over 7000x7000 px, so I don't think your solution is going to work. In addition, I'm still going to run into the same problem of having to apply that class and Javascript to the UC2-managed image data.
Thanks guys! I'll keep plugging, but if anything from above jumps out at you, please let me know!
-R
#4
OK, after looking around a bit - since UC2 is managing its own image library via the image or imagecache module (as shown above), would it be correct to use the zoomify_images() hook to put the images in question under Zoomify management?
If so, how would the explicit theme() calls in the above code affect this - or do they?
How does imagecache.module play into this?
Also - what is the significance of the $fid parameter returned by a zoomify_images() hook call? I this strictly for internal tracking on Zoomify's part? UC2 uses only the taxonomy term ID as the identifier linked to its managed catalog images - is this what I would use for $fid in the returned array?
Just trying to find a way to implement this with the least amount of hacking into the UC2 code...
Thanks!
-R
#5
The main problem is that Zoomify is designed to pull images from nodes, not from other objects such as taxonomy terms. I'm still thinking of simpler ideas but the obvious one is to re-engineer Zoomify to become independent of nodes, which would be a non-trivial undertaking.
The other solution is to bypass zoomify.module and go completely manual:
* Convert images to tiles offline
* Place the tiles in your
files/folder manually* Override the theme function (from which your second code snippet is taken) to manually host the Zoomify Flash viewer, copying what zoomify.module does in
theme_zoomify.If you're willing to sponsor development for the first option, I could work on it during the next 2 weeks.
#6
kratib,
Thanks for the suggestion about theming overrides based on theme_zoomify(). That appears to have done the trick. Attached is my theme file for my theme derived from the base Marvin theme, in case anyone else runs into the same thing and would like a relatively quick fix.
I wound up having to tap one of UC2's catalog hooks to find out which taxonomy term I was currently viewing in the catalog, and then use that info in a successive imagecache.module theme override to catch the uc_thumbnail preset images and properly generate the Zoomify div. I used Photoshop CS3 to generate the Zoomify directories offline, which worked like a charm.
It's not the most elegant workaround I've ever cooked up, and any additional suggestions on improvement would be appreciated. In the meantime, closing this off your books.
It would be nice to have a method in zoomify.module where you could pass an image path to it, and have it generate the appropriate HTML as the return data (an IMG tag or Zoomify DIV tag) and do any Zoomify-ing of the image data required if it's not already done. That way any module managing its own images could leverage the Zoomify viewer and module settings. I'd be willing to help out with that if there is enough interest and you don't have enough time... It looks like the core functionality is probably already there in the zoomify.module, it would just need to be massaged a bit.
-R
#7
Great! Thanks for sharing your solution. I will definitely add a general-purpose API function to zoomify arbitrary images.