I ran into a compatibility problem between 'EnlargeIt' and a plugin using the filter 'picture_url'. In my case it is the 'Mask URL' plugin - but the problem would affect any plugin that CHANGES the thumbnail URL - or wants to change the intermediate or fullsize URL.
EnlargeIt regenerates the thumbnail URL from scratch (previously generated by CPG and possibly edited by plugins) - and generates new intermediate/fullsize URL.
I made the following changes to codebase.php (based on most recent SVN version) to
- respect any thumbnail URL changes previously made
- invoke the pluginAPI for filter 'picture_url' after generating the intermediate/fullsize URL
In codebase.php find (line 87 at revision 7221 in function enlargeit_addparams)
} else {
$enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'];
}
// CASE 1: images
if (in_array($enl_filetyplower, $image_array) == TRUE) {
$enl_newthumb = '<img src="' . $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['thumb_pfx'] . $thumb['filename'] . '" ';
$enl_newthumb .= 'class="enlargeimg" ';
and replace with:
} else {
$enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'];
}
// since we are creating a new picture url - drive the pluginAPI to see if anyone else cares... //*GMC
$pic_row = array('pid' => $thumb['pid'], // set up parameter array for API call //*GMC
'filepath' => $thumb['filepath'], // specifying those parms we have access to //*GMC
'filename' => $thumb['filename'], // if additional fields needed, will need to //*GMC
'pwidth' => $thumb['pwidth'], // add database calls //*GMC
'pheight' => $thumb['pheight'], //*GMC
'filesize' => $thumb['filesize'], //*GMC
'url' => $enl_path, //*GMC
'mode' => 'normal', //*GMC
); //*GMC
$pic_row = CPGPluginAPI::filter('picture_url', $pic_row); // see if anyone else has interest //*GMC
$enl_path = $pic_row['url']; // use value returned from API call //*GMC
// CASE 1: images
if (in_array($enl_filetyplower, $image_array) == TRUE) {
//obtain current url from params (other plugins may have altered from default) //*GMC
$enl_matchfound = preg_match('/"([^"]+)"/', $params['{THUMB}'], $enl_matches); //*GMC
if ($enl_matchfound) { //*GMC
// use url from params //*GMC
$enl_newthumb = '<img src="' . $enl_matches[1] . '" '; //*GMC
} else { //*GMC
// unable to match - generate ourselves... //*GMC
$enl_newthumb = '<img src="' . $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['thumb_pfx'] . $thumb['filename'] . '" ';
} //*GMC
$enl_newthumb .= 'class="enlargeimg" ';
and find (line 102 at revision 7221 before above changes in function enlargeit_addparams)
$enl_newthumb .= 'border="0" onclick="enlarge(this);" longdesc="' . path2url($enl_path) . '" name="' . $thumb['pid'] . '" ';
and replace with:
// removed 'path2url' - should already be valid/safe url and this removed '=' and '?' that are valid for url query string //*GMC
//$enl_newthumb .= 'border="0" onclick="enlarge(this);" longdesc="' . path2url($enl_path) . '" name="' . $thumb['pid'] . '" '; //*GMC
$enl_newthumb .= 'border="0" onclick="enlarge(this);" longdesc="' . $enl_path . '" name="' . $thumb['pid'] . '" '; //*GMC
These changes should have no effect if no other plugin alters the URL's generating by CPG - but may fix other compatibility issues as well...
I would have discussed with Timos - but he hasn't been online in the forums for some time...
I wanted to offer this as a solution for those encountering conflicts.
Thanks!
Greg