使用文件获取缩略图javascript获取原始大小的图像

问题描述 投票:0回答:2

这是我的代码

  var dbx = new Dropbox.Dropbox({ accessToken: 'xxxxxxxxxxxxxxxxxxxxxxxx' });

function renderItems(items) {
  var filesContainer = document.getElementById('files');
  items.forEach(function(item) {
        dbx.filesGetThumbnail({ path: item.path_display }) // here we need to add size
    .then(function(response) {
            jQuery('#full__gallery__slider').append('<div class="item"><div class="gallery__box"><img src="'+window.URL.createObjectURL(response.fileBlob)+'" class="img-circle"></div></div>');
    })
    .catch(function(error) {
      console.log(error);
    });
  });
  }


dbx.filesListFolder({path: ''})
  .then(function(response) {
     renderItems(response.entries);
});

现在我得到像61X57的图像问题:我只想知道如何获取orignal图像

javascript dropbox-api
2个回答
0
投票

如果要检索原始图像数据,请改用the filesDownload method

filesGetThumbnail专门用于检索调整大小的图像版本,但filesDownload可用于检索任何类型文件的原始文件数据。


0
投票

我实际上使用下面的代码来获取图像的大小

var img = document.getElementById('imageid');
var width = img.clientWidth;
var height = img.clientHeight;

但我不确定dropbox api ..我无法保证

© www.soinside.com 2019 - 2024. All rights reserved.