Ecshop Product picture Path relative address change to absolute address or level two domain name method

Source: Internet
Author: User
Tags php file phpmyadmin

First, let's take a look at how to change the ecshop ad picture/data/afficheimg/relative path to absolute path address.
First open the function that controls the path of the picture, find the includes/lib_insert.php file, look for the functions insert_ads ($arr) function, and the following code:

The code is as follows Copy Code

Case 0://Photo ads
$SRC = (Strpos ($row [' Ad_code '], ' http://') = = False && strpos ($row [' Ad_code '], ' https://') = = False)?
' Http://www.111cn.net/'. Data_dir. "/afficheimg/$row [Ad_code]": $row [' Ad_code '];


OK, then look at your own advertising picture address, now has been changed to an absolute address.

Second, sometimes also need to ecshop product picture relative path to absolute path address, we first look at how to modify it.
Modify the function Get_image_path functions in the includes/lib_common.php file, search: Rewrite the URL address, in the following function Build_uri functions, in $uri = '; Added below $weburl = ' http://'. $_server[' server_name ']. ' /';
Then return the following $uri, replace it with the return $weburl. $uri;

Find the picture Format function Get_image_path return $url;

The code is as follows Copy Code
Return (Strpos ($url, ' http://') = = False && Strpos ($url, ' https://') = = False)? ' Http://www.111cn.net/'. $url: $url;


After the modification, this is the following:

The code is as follows Copy Code
function Get_image_path ($goods _id, $image = ', $thumb =false, $call = ' goods ', $del =false) {$url = Emptyempty ($image)?      $GLOBALS [' _cfg '] [' no_picture ']: $image;  Return (Strpos ($url, ' http://') = = False && Strpos ($url, ' https://') = = False)? ' Http://www.111cn.net/'. $url: $url; }


Third, to introduce the Ecshop product Details page inside the picture how to change to absolute path.

This is simpler, directly in the database to modify, open phpMyAdmin, execute the following SQL statement:

The code is as follows Copy Code
Update ecs_goods Set Goods_desc=replace (Goods_desc, ' src= '/images/upload/', ' src= ' http://www.111cn.net/images/ upload/')


If you do not have phpMyAdmin, you can also in the Ecshop background database management SQL query to execute.

Note: Regardless of the modification of the Ecshop file or the MySQL database, still the same as the old, be sure to remember to advance the file and database backup, right, these relative path to absolute path, many people do not understand exactly what is to do, why must be so modified, in fact, do not need to modify,

If it is a level two domain name directly in the replacement and program changes to replace the www.111cn.net into your level two domain name, such as M.111cn.net.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.