我只是初学者,想从我的文件夹中添加大约1000张图片,但我尝试了很多次但仍然无法这样做。我正在使用angularjs并能够使用$scope.image['image1.jpg','image2.jpg']
显示并可以在ng-repeat
中显示它,那么我可以为1000张图像做些什么?我将逐个加载???如果有更好的解决方案,请指导我?我想添加像这样的文件夹
var folderOfImages=/images/ "1000 images are here"
我这样做:
app.controller('PageCtrl', ['$scope', 'filterFilter', function ($scope, filterFilter) {
$scope.items = [{
src: '../images/gallery/6th-september/2013-09-07-09-42-23.jpg', desc: 'Image 01'
}, {
src: '../images/gallery/6th-september/2013-09-07-09-42-36.jpg', desc: 'Image 01'
}, {
src: '../images/gallery/6th-september/2013-09-07-09-42-46.jpg', desc: 'Image 01'
}, {
src: '../images/gallery/6th-september/2013-09-07-09-43-29.jpg', desc: 'Image 01'
}, {
src: '../images/gallery/6th-september/2013-09-07-09-43-43.jpg', desc: 'Image 01'
}, {
src: '../images/gallery/6th-september/2013-09-07-09-43-56.jpg', desc: 'Image 01'
}, {
...
}];
答案 0 :(得分:0)
您可以在$ scope中对数组使用ng-repeat,如下所示,这是您需要的吗?
如果您需要先加载文件名,则需要使用后端,因为不允许javascript检查系统信息。但它很容易。不幸的是,我不知道你需要哪个后端,所以请看看这些解决方案:
(function(angular) {
angular.module('ngRepeat', []).controller('repeatController', function($scope) {
$scope.images = [
"http://lorempixel.com/output/technics-q-g-100-100-1.jpg",
"http://lorempixel.com/output/technics-q-g-100-100-2.jpg",
"http://lorempixel.com/output/technics-q-g-100-100-3.jpg",
"http://lorempixel.com/output/technics-q-g-100-100-5.jpg",
"http://lorempixel.com/output/technics-q-g-100-100-6.jpg"
];
});
})(window.angular);

div {
display: inline-block;
padding: 5px;
}

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="ngRepeat" ng-controller="repeatController">
<div ng-repeat="img in images" >
<img ng-src="{{ img }}">
</div>
</div>
&#13;
答案 1 :(得分:0)
如果您能够使用某种数量有序的系统命名文件,那么可能值得尝试。虽然现在可以很好地扩展,但你可以尝试一下。同样,这取决于知道图像的数量和控制照片的命名惯例。
df1 = pd.DataFrame.from_records(np.random.rand(2,4), index = ['A','B'])
df2 = pd.DataFrame.from_records(np.random.rand(2,4), index = ['A','B'])
df1.T