Closed (fixed)
Project:
Insert
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Aug 2012 at 16:26 UTC
Updated:
17 Sep 2012 at 17:51 UTC
Jump to comment: Most recent file
When using imagecache and insert modules and variable "insert_absolute_paths" is set to FALSE:
This happens in includes/imagecache.inc
function template_preprocess_imagecache_insert_image(&$vars) {
}
Which behaves differently depending on whether "insert_absolute_paths" is TRUE or FALSE and causes the issue.
The fix is simple - when handling the case where "insert_absolute_paths" variable is set to FALSE simply use the same imagecache_create_url() function with a FALSE argument set for the $absolute default variable, such as:
$vars['url'] = imagecache_create_url($vars['preset_name'], $vars['item']['filepath'], FALSE, FALSE);
Regards,
Liran Tal.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | imagecache_incorrect_absolute_file_path-1717508-3.patch | 1015 bytes | lirantal |
| #3 | insert_imagecache_relative.patch | 872 bytes | quicksketch |
| #1 | imagecache_incorrect_absolute_file_path-1717508-1.patch | 672 bytes | lirantal |
Comments
Comment #1
lirantal commentedAttached is the patch to make this happen.
Comment #2
quicksketchThanks, good suggestion! I'm reviewing this now. Not a critical issue though (http://drupal.org/node/45111).
Comment #3
quicksketchThanks, the patch worked great, but we can simplify it down further and make it all one line. Looks like the $absolute parameter was added only in more recent versions of ImageCache. Nice that it's there, it significantly simplifies the situation. Committed this patch.
Comment #4
lirantal commentedSure, if we're at perfecting the code I'll also add a (bool) casting just to make sure.
Comment #5
quicksketchSounds good, I've added your extra (bool) check too. Though strict checking isn't common in Drupal contrib, we should be explicit when calling another module's functions. Thanks!