New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload component not work when img url has some params, example: show from aliyun oss #10102

Closed
didmehh opened this Issue Apr 17, 2018 · 6 comments

Comments

Projects
None yet
5 participants
@didmehh

didmehh commented Apr 17, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.3.1

Environment

chrome 65.0

Reproduction link

Steps to reproduce

i got example from here, then add some params to url. not work.

What is expected?

show image

What is actually happening?

not show

@ant-design-bot

This comment has been minimized.

ant-design-bot commented Apr 17, 2018

Hello @didmehh. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro. Issues labeled by Need Reproduce will be closed if no activities in 7 days.

@didmehh

This comment has been minimized.

didmehh commented Apr 17, 2018

i had provide another example for this issue.
then, i had resolve this issue by FileReader.
ps: i think the first link was clearly re-display for this issue. so, why need to reproduce again?
thanks.

@didmehh didmehh changed the title from upload component not work when show from aliyun oss to upload component not work when img url has some params, example: show from aliyun oss Apr 17, 2018

@afc163

This comment has been minimized.

Member

afc163 commented Apr 17, 2018

Did you mean the image url "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?time=20180417" will not display image correctly?

@didmehh

This comment has been minimized.

didmehh commented Apr 17, 2018

yep

@afc163 afc163 closed this in 3b00cf8 Apr 17, 2018

@jinxin479

This comment has been minimized.

jinxin479 commented Apr 19, 2018

I update antd to 3.4.1 ,but this problem is still exist .I check the node_modules of antd, the source code is not update.

@didmehh

This comment has been minimized.

didmehh commented Apr 19, 2018

hi guys, my antd version still at 3.3.1.
i had resolve it by parse remote img to base64.
for example:

function base64Url(url, callback) {
  let xhr = new XMLHttpRequest();
  xhr.onload = function() {
    let reader = new FileReader();
    reader.onloadend = function() {
      callback(reader.result);
    }
    reader.readAsDataURL(xhr.response);
  };
  xhr.open('GET', url);
  xhr.responseType = 'blob';
  xhr.send();
}

const url = 'http://img15.3lian.com/2015/f1/38/d/41.jpg'
base64Url(url, (result) => {
    console.log("result base64 url was", result)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment