I noticed that my imagecache urls were not appearing correctly on the canvas pages because their URIs were getting the Application ID inserted into them.

I ended up fixing this in my canvas theme. Just insert the following code into your template.php, change YOURTHEME to your theme and you should be golden.


function YOURTHEME_imagecache($presetname, $path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE, $absolute = TRUE) {
  // Check is_null() so people can intentionally pass an empty array of
  // to override the defaults completely.
  if (is_null($attributes)) {
    $attributes = array('class' => 'imagecache imagecache-'. $presetname);
  }
  if ($getsize && ($image = image_get_info(imagecache_create_path($presetname, $path)))) {
    $attributes['width'] = $image['width'];
    $attributes['height'] = $image['height'];
  }

  $attributes = drupal_attributes($attributes);
  $imagecache_url = imagecache_create_url($presetname, $path, FALSE, $absolute);
  
  $url = substr($imagecache_url, strpos($imagecache_url, '/sites/'));
  
  return '<img src="'. $url .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />';
}

This is a bit of a work-around, but it was alright. I'd very much like to work on a long term solution for this.

Comments

perceptum’s picture

THANKS!!

What a pain in the...

ahansen1’s picture

This worked great for me. Had to change the /sites to my appropriate path. Surprised there hasn't been a real fix for this?