Author Topic: How to delete path of the link??  (Read 17917 times)

0 Members and 1 Guest are viewing this topic.

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
How to delete path of the link??
« on: September 20, 2010, 08:44:15 AM »
Hi all. Full size of image is not showing for all. Right click and properties show link as: http://mydomain/photo/russia/224th-flight-unit//data/media/1/1d79652285a7e29009bad34a28ca0f6a.jpg
How can i delete path "photo/russia/224th-flight-unit/". Which file i need to change?

Many thanks!
« Last Edit: September 20, 2010, 01:36:14 PM by MrAndrew »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How to delete path of the link??
« Reply #1 on: September 20, 2010, 02:10:27 PM »
4images does not use full paths, it uses relative. It only shows ./data/media/1/1d79652285a7e29009bad34a28ca0f6a.jpg (you can see it in page source) the rest of the url the browser adds (unless of course you've modified something in 4images)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: How to delete path of the link??
« Reply #2 on: September 20, 2010, 02:15:42 PM »
./data/media/1/1d79652285a7e29009bad34a28ca0f6a.jpg - where can i find this?

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: How to delete path of the link??
« Reply #3 on: September 20, 2010, 02:19:29 PM »
View your detail page source .. you can get the link of your images..

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: How to delete path of the link??
« Reply #4 on: September 20, 2010, 02:27:22 PM »
I need path, where generated this link. There is no in details.php and functions.php.

V@no, sure! I want to understand why the photo is not showing, and drawn to this link: http://mydomain/photo/russia/224th-flight-unit//data/media/1/1d79652285a7e29009bad34a28ca0f6a.jpg

I`m using a mode_rewrite and I think that i need to add "/" before link, and all will be done. I`ve added this to another links, all work done, but main photo not showing. Thumbnails works done too, after adding "/" before link
« Last Edit: September 20, 2010, 02:46:13 PM by MrAndrew »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How to delete path of the link??
« Reply #5 on: September 20, 2010, 05:27:06 PM »
the path is generated in functions.php in get_file_path() function

but again, unless you did something to the code, it only generates relative path, not full internet path.

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: How to delete path of the link??
« Reply #6 on: September 20, 2010, 05:31:11 PM »
Hm.. Nothing to change :-(  :cry:

function get_file_path($file_name ""$image_type "media"$cat_id 0$in_admin 0$return_icon 1$check_remote CHECK_REMOTE_FILES) {
  
$return_code = ($return_icon) ? ICON_PATH."/404.gif" 0;
  if (empty(
$file_name)) {
    return 
$return_code;
  }
  if (
is_remote($file_name)) {
    
$check_handle "check_remote_".$image_type;
    return (
$check_handle($file_name) && remote_file_exists($file_name$check_remote)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is"$file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" $file_name) : $return_code;
  }
  elseif (
is_local_file($file_name)) {
    
$check_handle "check_local_".$image_type;
    
$file_name = ($in_admin && preg_match("/^([\.]+|[^\/])/"$file_name)) ? "../".$file_name $file_name;
    if (!
file_exists($file_name)) {
      
$file_path preg_replace("/\/{2,}/""/"get_document_root()."/".$file_name);
      return (
$check_handle($file_name) && file_exists($file_path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is"$file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" $file_name) : $return_code;
    }
    else {
      return 
$file_name;
    }
  }
  else {
    
$check_handle "check_".$image_type."_type";
    
$path = (($image_type == "media") ? (($cat_id) ? MEDIA_PATH."/".$cat_id MEDIA_TEMP_PATH) : (($cat_id) ? THUMB_PATH."/".$cat_id THUMB_TEMP_PATH))."/".$file_name;
    return (
$check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is"$file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" $path) : $return_code;
  }
}

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How to delete path of the link??
« Reply #7 on: September 20, 2010, 05:32:52 PM »
Also, just in case check out includes/constants.php
By default there is a commented line:
// define('SCRIPT_URL', 'http://www.yourdomain.com/4images'); //no trailing slash

If you have such line uncommented, then add // to the front (comment it out)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: How to delete path of the link??
« Reply #8 on: September 20, 2010, 05:37:05 PM »
This line uncommented. I have received this problem after add next:
Code: [Select]
RewriteRule ^photo/(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
and some modifications in the sessions.php

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How to delete path of the link??
« Reply #9 on: September 20, 2010, 06:22:58 PM »
if that line is uncommented, then that is where the problem is. That line should be commented out or not exist for normal 4images operation.

P.S.
this topic has nothing to do with 4images itself, moving to programing section.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: How to delete path of the link??
« Reply #10 on: September 20, 2010, 06:32:28 PM »
Nothing result

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How to delete path of the link??
« Reply #11 on: September 20, 2010, 06:35:25 PM »
then I have no clue what else you've modified...
link to the site may help..
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: How to delete path of the link??
« Reply #12 on: September 20, 2010, 06:41:50 PM »
Now i have my default session.php and .htaccess

i`ll show a code firstly to you, then if no result setup and show link

This is line in .htaccess

Code: [Select]
RewriteRule ^photo/(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
This is sessions.php

/* ORIGINAL CODE
  function url($url, $amp = "&") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
*/
  
function url($url$amp "&") {
    global 
$l$user_info;
    
$dummy_array explode("#"$url);
    
$url $dummy_array[0];
    
$url str_replace('&''&'$url);
    if (!
defined('IN_CP')) {
      if (
strstr($url'index.php')) {
        
$url str_replace('index.php'''$url);
      }
      elseif (
strstr($url'search.php')) {
        if (
strstr($url'page=')) {
          
preg_match('#page=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('search.php''search.'.$matches[1].'.htm'$url);
            
$query str_replace('page='.$matches[1].'&'''$query);
            
$query str_replace('&page='.$matches[1], ''$query);
            
$query str_replace('page='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('search.php''search.htm'$url);
        }
      }
      elseif (
strstr($url'lightbox.php')) {
        if (
strstr($url'page=')) {
          
preg_match('#page=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('lightbox.php''lightbox.'.$matches[1].'.htm'$url);
            
$query str_replace('page='.$matches[1].'&'''$query);
            
$query str_replace('&page='.$matches[1], ''$query);
            
$query str_replace('page='.$matches[1], ''$query);
            if (!empty(
$query)) {
                
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('lightbox.php''lightbox.htm'$url);
        }
      }
      elseif (
strstr($url'categories.php')) {
        if (
strstr($url'cat_id=') && strstr($url'page=')) {
          
preg_match('#cat_id=([0-9]+)&?#'$url$matches1);
          
preg_match('#page=([0-9]+)&?#'$url$matches2);
          if (isset(
$matches1[1]) && isset($matches2[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('categories.php''cat'.$matches1[1].'.'.$matches2[1].'.htm'$url);
            
$query str_replace('cat_id='.$matches1[1].'&'''$query);
            
$query str_replace('&cat_id='.$matches1[1], ''$query);
            
$query str_replace('cat_id='.$matches1[1], ''$query);
            
$query str_replace('page='.$matches2[1].'&'''$query);
            
$query str_replace('&page='.$matches2[1], ''$query);
            
$query str_replace('page='.$matches2[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        elseif (
strstr($url'cat_id=')) {
          
preg_match('#cat_id=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$cat_url get_category_url($matches[1]);
            
$url   str_replace('categories.php''cat'.$cat_url.'.htm'$url);
            
$query str_replace('cat_id='.$matches[1].'&'''$query);
            
$query str_replace('&cat_id='.$matches[1], ''$query);
            
$query str_replace('cat_id='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('categories.php''cat.htm'$url);
        }
      }
      elseif (
strstr($url'/details.php?image_id=')) {
        if (
strstr($url'image_id=') && strstr($url'mode=')) {
          
preg_match('#image_id=([0-9]+)&?#'$url$matches1);
          
preg_match('#mode=([a-zA-Z0-9]+)&?#'$url$matches2);
          if (isset(
$matches1[1]) && isset($matches2[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('details.php''photo'.$matches1[1].'.'.$matches2[1].'.htm'$url);
            
$query str_replace('image_id='.$matches1[1].'&'''$query);
            
$query str_replace('&image_id='.$matches1[1], ''$query);
            
$query str_replace('image_id='.$matches1[1], ''$query);
            
$query str_replace('mode='.$matches2[1].'&'''$query);
            
$query str_replace('&mode='.$matches2[1], ''$query);
            
$query str_replace('mode='.$matches2[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
preg_match('#image_id=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('details.php''photo'.get_image_url($matches[1]).'.htm'$url);
            
$query str_replace('image_id='.$matches[1].'&'''$query);
            
$query str_replace('&image_id='.$matches[1], ''$query);
            
$query str_replace('image_id='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
      }
      elseif (
strstr($url'postcards.php?image_id=')) {
        
preg_match('#image_id=([0-9]+)&?#'$url$matches);
        if (isset(
$matches[1])) {
          
$split explode('?'$url);
          
$url $split[0];
          
$query = @$split[1];
          
$url   str_replace('postcards.php''postcard.img'.$matches[1].'.htm'$url);
          
$query str_replace('image_id='.$matches[1].'&'''$query);
          
$query str_replace('&image_id='.$matches[1], ''$query);
          
$query str_replace('image_id='.$matches[1], ''$query);
          if (!empty(
$query)) {
            
$url .= '?' $query;
          }
        }
      }
    }
    if (
$this->mode == "get" && strstr($url$this->session_id)) {
      
$url .= strpos($url'?') !== false '&' '?';
      
$url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty(
$l)) {
      
$url .= strpos($url'?') ? '&' '?';
      
$url .= "l=".$l;
    }
    
$url str_replace('&'$amp$url);
    
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return 
$url;
  }
//end of class
//Mod_bmollet
/**
 * Get the category url
 * @param int $cat_id The id of the category
 * @param string $cat_url The current status of the URL
 */
function get_category_url($cat_id,$cat_url '')
{
    global 
$site_db;
    
$sql "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
    
$result $site_db->query($sql);
    
$row $site_db->fetch_array($result);
    
$row['cat_name'] = strtr($row['cat_name'], "eeeaeauoiaABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
    
$cat_url  '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
    
// if you want full path of category in url, put next line in comment    
    
return $cat_url;
    if( 
$row['cat_parent_id'] != 0)
    {
        return 
get_category_url($row['cat_parent_id'],$cat_url);    
    }
    else
    {
        return 
$cat_url;
    }
}
//Mod_bmollet
/**
 * Get the image url
 * @param int $image_id The id of the image
 */
function get_image_url($image_id)
{
    global 
$site_db;
    
$sql "SELECT cat_id,image_name,image_airline,image_aircraft,image_aircraftnamealt FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
    
$result $site_db->query($sql);
    
$row $site_db->fetch_array($result);
    
$row['image_name'] = strtr($row['image_name'], "eeeaeauoiaABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
    
$row['image_airline'] = strtr($row['image_airline'], "eeeaeauoiaABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
  
$row['image_aircraft'] = strtr($row['image_aircraft'], "eeeaeauoiaABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
    
$row['image_aircraftnamealt'] = strtr($row['image_aircraftnamealt'], "eeeaeauoiaABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
    
// if you want comlpete path to image in url, remove comment from following line
    //return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;    
    
return '/'.str_replace('+','-',urlencode($row['image_name'])).'/'.str_replace('+','-',urlencode($row['image_airline'])).'/'.str_replace('+','-',urlencode($row['image_aircraft'])).'-'.str_replace('+','-',urlencode($row['image_aircraftnamealt'])).'-'.$image_id;
}


After above my style css was not worked. I corrected my path to all files, including thumbs. In start of line i added "/". Now work done, but not show big image

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How to delete path of the link??
« Reply #13 on: September 20, 2010, 06:54:29 PM »
I don't understand how this has anything to do with addresses for image files. All that is related to details PAGE addresses...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: How to delete path of the link??
« Reply #14 on: September 21, 2010, 04:56:11 PM »
Ok! After resolved my problem a have another question:

How to redirect from this http://mydomain.ru/img1676.htm to new link? Help me please with .htaccess

This is my line
Code: [Select]
RewriteRule ^photo-(.*)-([0-9]+).htm$ details.php?image_id=$2&%{QUERY_STRING}