Needs review
Project:
Drupal for Facebook
Version:
6.x-3.0-rc14
Component:
Canvas Pages (iframe)
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Jul 2011 at 00:20 UTC
Updated:
23 Aug 2011 at 03:32 UTC
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
Comment #1
perceptum commentedTHANKS!!
What a pain in the...
Comment #2
ahansen1 commentedThis worked great for me. Had to change the /sites to my appropriate path. Surprised there hasn't been a real fix for this?