WordPress.org

Forums

BMo Expo - a WordPress and NextGEN Gallery plugin
[resolved] Filepath to Images Not Correct (7 posts)

  1. SpillnerDesign
    Member
    Posted 1 year ago #

    Hi,

    your plugin seems awesome so far but I can't get it going quite right yet.

    The filepath to the images is not being inserted right. I am running my website on a localhost for development purposes.

    The path is being displayed as follows: http://localhost/eggert/C:/xampp/htdocs/eggert/wp-content/gallery/chicago/img_4243.jpg

    So he puts the absolute filepath right after the URL for the website. Any ideas on what I'm doing wrong or how to repair this?

    Many thanks.
    Kim

    http://wordpress.org/plugins/bmo-expo/

  2. Benedikt Mo
    Member
    Plugin Author

    Posted 1 year ago #

    hm... maybe a xampp problem.

    Do you run xampp on windows or mac?

  3. fredzzz
    Member
    Posted 1 year ago #

    Here the same problem. I'm running xampp on windows.

    How can i solve the problem?
    Fred

  4. SpillnerDesign
    Member
    Posted 1 year ago #

    I'm running xampp on widows as well.

    I'll just try on a live site then. But if you figure something out I'd be happy to read it here.

  5. miguelpinheiro
    Member
    Posted 1 year ago #

    hi all,

    I am using windows operating system as host and I have noticed the same problem in both BMo Expo and Nextgen ScrollGallery plugins.
    I think the problem comes from metadata info about images. In my case, they come from NextGen Gallery.
    Yesterday, I wrote an routine to strip ABSPATH info from $picture->path and the Nextgen ScrollGallery plugin is working as expected. Even the "divide by zero" error was gone. I consider I am in beta version and tomorrow after more tests I will have a final version to send to Benedikt Mo as a suggestion.

  6. miguelpinheiro
    Member
    Posted 1 year ago #

    @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: http://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
    }
  7. Benedikt Mo
    Member
    Plugin Author

    Posted 1 year ago #

    Hi miguelpinheiro,
    thank you very much for that fix.
    I will check your code and will integrate it in the next version.
    Best regards Benedikt

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • BMo Expo - a WordPress and NextGEN Gallery plugin
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.