为不同的图像源更改根目录

时间:2018-11-19 22:07:29

标签: javascript angularjs .htaccess

我有一个程序,其中包含服务器上的图像。 config.js看起来像:

var businessDetails = {};
var Url = 'http://api.BBB.org.il';
var apiUrl = Url + '?apiCtrl=';
var publicRoot = Url + "/public/";
var imgRoot = publicRoot + "images/";

和类似js的

$scope.getBusinessDetails = function() {
  $scope.business_id = $rootScope.businessDetails.business_id;
  $scope.business_name = $rootScope.businessDetails.business_name_commercial;
  $scope.business_tel = $rootScope.businessDetails.business_phone;
  $scope.business_address = $rootScope.businessDetails.business_address;
  $scope.business_logo = $rootScope.businessDetails.logo_url;
  $scope.business_folder = $rootScope.businessDetails.business_folder;
}

当我从

更改路径时,我将图像上传到服务器上的其他文件夹(business_folder不同)
<img ng-src="{{imageRoot}}{{business_folder}}/food/{{pizza.picture}}" class="img-responsive center-block"/>

它显示图像的默认值。我在包含

的程序的图像文件夹中有.htaccess文件
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.+)$ index.php/?url=$1 [QSA,L] 

我应该更改它以获得正确的路径吗?我该如何解决? 谢谢

0 个答案:

没有答案