Magic Toolbox

Magic Zoom Drupal integration Drupal support

Installation instructions for adding Magic Zoom to Drupal CMS websites.

Instructions

1. Either buy Magic Zoom or download the demo version.

2. Place magiczoom.css and mz-packed.js in the misc folder of your Drupal installation.

3. Edit the file \include\theme.inc by replacing the function theme_images with the following function:

function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {

 if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path))))

 {

  $attributes = drupal_attributes($attributes);

  $url = (url($path) == $path) ? $path : (base_path() . $path);

  if (strlen(stristr(check_url($url),"thumbnail"))>0)

  {

   return '<img src="'. check_url($url) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />';

  }

  elseif (strlen(stristr(check_url($url),"preview"))>0)

  {

   return '<a href="'. check_url(str_replace(".preview","",$url)) .'" class="MagicZoom"><img src="'. check_url($url) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .'/></a>';

  }

  else

  {

   return '<img src="'. check_url($url) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />';

  }

 }

}

4. Edit the file \themes\[theme used]\page.tpl.php by replacing:

<?php print $scripts ?>

with:

<script src="/misc/mz-packed.js" type="text/javascript"></script>

<link rel="stylesheet" href="/misc/MagicZoom.css" type="text/css" media="screen" />

That's it!

Other installation guides

Easy guides to add Magic Zoom to your website:

Buy Magic Zoom

£25
£95
£395

(Non-commercial sites get it free).

©2008 Magic Toolbox   About | Contact | Support | Newsletter | Testimonials | License Agreement | Terms | Privacy