@benedikt Mo
I made a routine to fix filepath to images as SpillnerDesign said.
I have tested it with the version 1.8.2 of Nextgen ScrollGallery, but I believe it fix BMo Expo plugin in the same way.
I hope you would like this routine.
Thanks,
Miguel
side note: this is not related to “divide by zero” error.
// mlsp
/* the problem
* I have noticed that scrollgallery create links to images using the following code
* SCROLLGALLERY_SITEBASE_URL . "/" . $picture->path ."/" . $picture->file
* This works in almost all unix environments, but, in windows, $picture->path has the absolute fullpath to the image file and the link become invalid.
* Like that: https://mysite.org/wordpress/E:/Home/httpdocs/wordpress/wp-content/gallery/2013/dsc_3823.jpg
*
/* the goal
*In the example above, E:/Home/httpdocs/wordpress/wp-content/gallery/2013 is the $picture->path and needs to be adjusted.
*My goal is to remove the absolute fullpath part from the result of $picture->path.
*
/* the strategy
* I have noticed the part I want to remove is the absolute full path to site I know as ABSPATH.
* Then I made a routine named nggSGStartPath that remove the ABSPATH from $picture->path and inserted the code
* $picture->path = nggSGStartPath(SCROLLGALLERY_SITEBASE_HOMEPATH,$picture->path);
* at the right place.
*
* There is one caveat, I mean, ABSPATH is like E:\Home\httpdocs\wordpress/ (note the first and the last slash) and $picture->path is like E:/Home/httpdocs/wordpress/wp-content/gallery/2013.
* I have to deal with it.
* We believe this routine does not break unix hosted systems.
*/
//mlsp
//this routine removes the start of a full path as e:\folder1\folder2 becomes \folder2 after removing e:\folder1
//but startPath needs to be at least 2 characters long (this is to not touch fullPath when "" or "\") and be smaller than fullPath (this is to avoid an error in substr)
//yet, we deal with slashes in StartPath, but not in FullPath (we trust FullPath uses only /)
define('SCROLLGALLERY_SITEBASE_HOMEPATH' , ABSPATH);
function nggSGStartPath ($strStartPath = "", $strFullPath = "", $intMinLen = 2){
if (strlen($strStartPath)< $intMinLen) return (string) $strFullPath; // does nothing
if (strlen($strStartPath) >= strlen($strFullPath)) return (string) $strFullPath; // does nothing
$strStartPath = str_replace("\\","/", $strStartPath ); // any slash (\) must be translated in (/) to be web friendly as in FullPath
if (strtolower($strStartPath)==strtolower(substr($strFullPath, 0, strlen($strStartPath)))) {
// if we found startPath in the begining of FullPath then we cut it off.
$strFullPath = substr($strFullPath,strlen($strStartPath));
return (string) $strFullPath;
}
return (string) $strFullPath; // does nothing
}